Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(ct): typed hooks (#17935)

sand4rt410b4447c801
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>): void;
-export declare function afterMount(callback: (params: { hooksConfig: any }) => Promise<void>): 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>): void;
+export declare function afterMount(callback: (params: { hooksConfig: JsonObject }) => Promise<void>): 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>): void;
-export declare function afterMount(callback: (params: { hooksConfig: any }) => Promise<void>): 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>): void;
+export declare function afterMount(callback: (params: { hooksConfig: JsonObject }) => Promise<void>): 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>): void;
-export declare function afterMount(callback: (params: { hooksConfig: any, svelteComponent: SvelteComponent }) => Promise<void>): 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>): void;
+export declare function afterMount(callback: (params: { hooksConfig: JsonObject, svelteComponent: SvelteComponent }) => Promise<void>): 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>): void;
-export declare function afterMount(callback: (params: { app: App, hooksConfig: any, instance: ComponentPublicInstance }) => Promise<void>): 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>): void;
+export declare function afterMount(callback: (params: { app: App, hooksConfig: JsonObject, instance: ComponentPublicInstance }) => Promise<void>): 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>): void;
-export declare function afterMount(callback: (params: { hooksConfig: any, instance: CombinedVueInstance<Vue, object, object, object, Record<never, any>> }) => Promise<void>): 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>): void;
+export declare function afterMount(callback: (params: { hooksConfig: JsonObject, instance: CombinedVueInstance<Vue, object, object, object, Record<never, any>> }) => Promise<void>): void;