From 410b4447c801a6a9d814c6eda42b0b6681596a3c Mon Sep 17 00:00:00 2001 From: sand4rt Date: Mon, 10 Oct 2022 21:46:42 +0200 Subject: [PATCH] feat(ct): typed hooks (#17935) --- packages/playwright-ct-react/hooks.d.ts | 8 ++++++-- packages/playwright-ct-solid/hooks.d.ts | 8 ++++++-- packages/playwright-ct-svelte/hooks.d.ts | 8 ++++++-- packages/playwright-ct-vue/hooks.d.ts | 8 ++++++-- packages/playwright-ct-vue2/hooks.d.ts | 8 ++++++-- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/packages/playwright-ct-react/hooks.d.ts b/packages/playwright-ct-react/hooks.d.ts index 36ac2620fa..94e83bc9af 100644 --- a/packages/playwright-ct-react/hooks.d.ts +++ b/packages/playwright-ct-react/hooks.d.ts @@ -14,5 +14,9 @@ * limitations under the License. */ -export declare function beforeMount(callback: (params: { hooksConfig: any }) => Promise): void; -export declare function afterMount(callback: (params: { hooksConfig: any }) => Promise): void; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; +export declare function beforeMount(callback: (params: { hooksConfig: JsonObject }) => Promise): void; +export declare function afterMount(callback: (params: { hooksConfig: JsonObject }) => Promise): void; diff --git a/packages/playwright-ct-solid/hooks.d.ts b/packages/playwright-ct-solid/hooks.d.ts index 36ac2620fa..94e83bc9af 100644 --- a/packages/playwright-ct-solid/hooks.d.ts +++ b/packages/playwright-ct-solid/hooks.d.ts @@ -14,5 +14,9 @@ * limitations under the License. */ -export declare function beforeMount(callback: (params: { hooksConfig: any }) => Promise): void; -export declare function afterMount(callback: (params: { hooksConfig: any }) => Promise): void; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; +export declare function beforeMount(callback: (params: { hooksConfig: JsonObject }) => Promise): void; +export declare function afterMount(callback: (params: { hooksConfig: JsonObject }) => Promise): void; diff --git a/packages/playwright-ct-svelte/hooks.d.ts b/packages/playwright-ct-svelte/hooks.d.ts index 958eea4342..e6a3172d4c 100644 --- a/packages/playwright-ct-svelte/hooks.d.ts +++ b/packages/playwright-ct-svelte/hooks.d.ts @@ -16,5 +16,9 @@ import type { SvelteComponent } from "svelte"; -export declare function beforeMount(callback: (params: { hooksConfig: any }) => Promise): void; -export declare function afterMount(callback: (params: { hooksConfig: any, svelteComponent: SvelteComponent }) => Promise): void; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; +export declare function beforeMount(callback: (params: { hooksConfig: JsonObject }) => Promise): void; +export declare function afterMount(callback: (params: { hooksConfig: JsonObject, svelteComponent: SvelteComponent }) => Promise): void; diff --git a/packages/playwright-ct-vue/hooks.d.ts b/packages/playwright-ct-vue/hooks.d.ts index 1a02376063..5879f5de70 100644 --- a/packages/playwright-ct-vue/hooks.d.ts +++ b/packages/playwright-ct-vue/hooks.d.ts @@ -16,5 +16,9 @@ import { App, ComponentPublicInstance } from 'vue'; -export declare function beforeMount(callback: (params: { app: App, hooksConfig: any }) => Promise): void; -export declare function afterMount(callback: (params: { app: App, hooksConfig: any, instance: ComponentPublicInstance }) => Promise): void; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; +export declare function beforeMount(callback: (params: { app: App, hooksConfig: JsonObject }) => Promise): void; +export declare function afterMount(callback: (params: { app: App, hooksConfig: JsonObject, instance: ComponentPublicInstance }) => Promise): void; diff --git a/packages/playwright-ct-vue2/hooks.d.ts b/packages/playwright-ct-vue2/hooks.d.ts index 74d9b5d788..300ad3990c 100644 --- a/packages/playwright-ct-vue2/hooks.d.ts +++ b/packages/playwright-ct-vue2/hooks.d.ts @@ -16,5 +16,9 @@ import { CombinedVueInstance, Vue } from 'vue/types/vue'; -export declare function beforeMount(callback: (params: { hooksConfig: any }) => Promise): void; -export declare function afterMount(callback: (params: { hooksConfig: any, instance: CombinedVueInstance> }) => Promise): void; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; +export declare function beforeMount(callback: (params: { hooksConfig: JsonObject }) => Promise): void; +export declare function afterMount(callback: (params: { hooksConfig: JsonObject, instance: CombinedVueInstance> }) => Promise): void;