From db95038645d702c900dd19dadf44fc6cd777dbe2 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 21 Sep 2024 21:50:54 +0530 Subject: [PATCH 1/3] fix: use typeof operators --- maxun-core/src/interpret.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index 0543d71f..ddc5d915 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -213,7 +213,7 @@ export default class Interpreter extends EventEmitter { : Object.entries(value).map((a) => Object.fromEntries([a])); // every condition is treated as a single context - switch (key as keyof typeof operators) { + switch (key as (typeof operators)[number]) { case '$and': return array?.every((x) => this.applicable(x, context)); case '$or': From d870a722ca09b3522a824230697b29544dd80780 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 21 Sep 2024 22:16:29 +0530 Subject: [PATCH 2/3] feat: assert type of values to any[] --- maxun-core/src/preprocessor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxun-core/src/preprocessor.ts b/maxun-core/src/preprocessor.ts index 7c31004e..7957c06b 100644 --- a/maxun-core/src/preprocessor.ts +++ b/maxun-core/src/preprocessor.ts @@ -60,7 +60,7 @@ export default class Preprocessor { } // Recursion general case - return Object.values(object) + return (Object.values(object) as any[]) .reduce((p: string[], v: any): string[] => [...p, ...getParamsRecurse(v)], []); } return []; From 9eec16feeaeb503a49e7855ed03b7a5c6865039f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 21 Sep 2024 22:20:04 +0530 Subject: [PATCH 3/3] fix: rename to maxun-core --- maxun-core/src/interpret.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index ddc5d915..158d9978 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -213,7 +213,7 @@ export default class Interpreter extends EventEmitter { : Object.entries(value).map((a) => Object.fromEntries([a])); // every condition is treated as a single context - switch (key as (typeof operators)[number]) { + switch (key as keyof typeof operators) { case '$and': return array?.every((x) => this.applicable(x, context)); case '$or': @@ -253,7 +253,7 @@ export default class Interpreter extends EventEmitter { * calls all mentioned functions on the Page object.\ * \ * Manipulates the iterator indexes (experimental feature, likely to be removed in - * the following versions of waw-interpreter) + * the following versions of maxun-core) * @param page Playwright Page object * @param steps Array of actions. */