From d85d615846dfc0e2bc53525178ad75ccc5613999 Mon Sep 17 00:00:00 2001 From: sand4rt Date: Thu, 22 Sep 2022 06:14:20 +0200 Subject: [PATCH] feat(ct): type-safe hook config (#17232) --- packages/playwright-ct-react/index.d.ts | 7 ++++++- packages/playwright-ct-solid/index.d.ts | 7 ++++++- packages/playwright-ct-vue/index.d.ts | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/playwright-ct-react/index.d.ts b/packages/playwright-ct-react/index.d.ts index 17c946ac1b..ebf7ff473f 100644 --- a/packages/playwright-ct-react/index.d.ts +++ b/packages/playwright-ct-react/index.d.ts @@ -34,8 +34,13 @@ export type PlaywrightTestConfig = Omit & { } }; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; + export interface MountOptions { - hooksConfig?: any; + hooksConfig?: JsonObject; } interface MountResult extends Locator { diff --git a/packages/playwright-ct-solid/index.d.ts b/packages/playwright-ct-solid/index.d.ts index b19433094f..a260249311 100644 --- a/packages/playwright-ct-solid/index.d.ts +++ b/packages/playwright-ct-solid/index.d.ts @@ -34,8 +34,13 @@ export type PlaywrightTestConfig = Omit & { } }; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; + export interface MountOptions { - hooksConfig?: any; + hooksConfig?: JsonObject; } interface MountResult extends Locator { diff --git a/packages/playwright-ct-vue/index.d.ts b/packages/playwright-ct-vue/index.d.ts index 23f6013437..b5e7295c16 100644 --- a/packages/playwright-ct-vue/index.d.ts +++ b/packages/playwright-ct-vue/index.d.ts @@ -34,13 +34,18 @@ export type PlaywrightTestConfig = Omit & { } }; +type JsonPrimitive = string | number | boolean | null; +type JsonValue = JsonPrimitive | JsonObject | JsonArray; +type JsonArray = JsonValue[]; +type JsonObject = { [Key in string]?: JsonValue }; + type Slot = string | string[]; export interface MountOptions> { props?: Props, slots?: Record & { default?: Slot }; on?: Record, - hooksConfig?: any, + hooksConfig?: JsonObject, } interface MountResult> extends Locator {