Skip to content

Commit c132756

Browse files
authored
cherry-pick(#22005): fix(ct): vue revert json object as prop (#22039)
Original PR: #22005 References #22003
1 parent 847b546 commit c132756

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

packages/playwright-ct-vue/index.d.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ type JsonObject = { [Key in string]?: JsonValue };
4141

4242
type Slot = string | string[];
4343

44-
export interface MountOptions<HooksConfig extends JsonObject, Props extends JsonObject> {
44+
export interface MountOptions<
45+
HooksConfig extends JsonObject,
46+
Props extends Record<string, unknown>
47+
> {
4548
props?: Props;
4649
slots?: Record<string, Slot> & { default?: Slot };
4750
on?: Record<string, Function>;
4851
hooksConfig?: HooksConfig;
4952
}
5053

51-
interface MountResult<Props extends JsonObject> extends Locator {
54+
interface MountResult<Props extends Record<string, unknown>> extends Locator {
5255
unmount(): Promise<void>;
5356
update(options: Omit<MountOptions<never, Props>, 'hooksConfig'>): Promise<void>;
5457
}
@@ -62,9 +65,12 @@ export interface ComponentFixtures {
6265
mount(component: JSX.Element): Promise<MountResultJsx>;
6366
mount<HooksConfig extends JsonObject>(
6467
component: any,
65-
options?: MountOptions<HooksConfig, JsonObject>
66-
): Promise<MountResult<JsonObject>>;
67-
mount<HooksConfig extends JsonObject, Props extends JsonObject = JsonObject>(
68+
options?: MountOptions<HooksConfig, Record<string, unknown>>
69+
): Promise<MountResult<Record<string, unknown>>>;
70+
mount<
71+
HooksConfig extends JsonObject,
72+
Props extends Record<string, unknown> = Record<string, unknown>
73+
>(
6874
component: any,
6975
options: MountOptions<HooksConfig, never> & { props: Props }
7076
): Promise<MountResult<Props>>;

packages/playwright-ct-vue2/index.d.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ type JsonObject = { [Key in string]?: JsonValue };
4141

4242
type Slot = string | string[];
4343

44-
export interface MountOptions<HooksConfig extends JsonObject, Props extends JsonObject> {
44+
export interface MountOptions<
45+
HooksConfig extends JsonObject,
46+
Props extends Record<string, unknown>
47+
> {
4548
props?: Props;
4649
slots?: Record<string, Slot> & { default?: Slot };
4750
on?: Record<string, Function>;
4851
hooksConfig?: HooksConfig;
4952
}
5053

51-
interface MountResult<Props extends JsonObject> extends Locator {
54+
interface MountResult<Props extends Record<string, unknown>> extends Locator {
5255
unmount(): Promise<void>;
5356
update(options: Omit<MountOptions<never, Props>, 'hooksConfig'>): Promise<void>;
5457
}
@@ -62,9 +65,12 @@ export interface ComponentFixtures {
6265
mount(component: JSX.Element): Promise<MountResultJsx>;
6366
mount<HooksConfig extends JsonObject>(
6467
component: any,
65-
options?: MountOptions<HooksConfig, JsonObject>
66-
): Promise<MountResult<JsonObject>>;
67-
mount<HooksConfig extends JsonObject, Props extends JsonObject = JsonObject>(
68+
options?: MountOptions<HooksConfig, Record<string, unknown>>
69+
): Promise<MountResult<Record<string, unknown>>>;
70+
mount<
71+
HooksConfig extends JsonObject,
72+
Props extends Record<string, unknown> = Record<string, unknown>
73+
>(
6874
component: any,
6975
options: MountOptions<HooksConfig, never> & { props: Props }
7076
): Promise<MountResult<Props>>;

0 commit comments

Comments
 (0)