Skip to content

Commit

Permalink
cherry-pick(#22005): fix(ct): vue revert json object as prop (#22039)
Browse files Browse the repository at this point in the history
Original PR: #22005
References #22003
  • Loading branch information
yury-s committed Mar 28, 2023
1 parent 847b546 commit c132756
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 11 additions & 5 deletions packages/playwright-ct-vue/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ type JsonObject = { [Key in string]?: JsonValue };

type Slot = string | string[];

export interface MountOptions<HooksConfig extends JsonObject, Props extends JsonObject> {
export interface MountOptions<
HooksConfig extends JsonObject,
Props extends Record<string, unknown>
> {
props?: Props;
slots?: Record<string, Slot> & { default?: Slot };
on?: Record<string, Function>;
hooksConfig?: HooksConfig;
}

interface MountResult<Props extends JsonObject> extends Locator {
interface MountResult<Props extends Record<string, unknown>> extends Locator {
unmount(): Promise<void>;
update(options: Omit<MountOptions<never, Props>, 'hooksConfig'>): Promise<void>;
}
Expand All @@ -62,9 +65,12 @@ export interface ComponentFixtures {
mount(component: JSX.Element): Promise<MountResultJsx>;
mount<HooksConfig extends JsonObject>(
component: any,
options?: MountOptions<HooksConfig, JsonObject>
): Promise<MountResult<JsonObject>>;
mount<HooksConfig extends JsonObject, Props extends JsonObject = JsonObject>(
options?: MountOptions<HooksConfig, Record<string, unknown>>
): Promise<MountResult<Record<string, unknown>>>;
mount<
HooksConfig extends JsonObject,
Props extends Record<string, unknown> = Record<string, unknown>
>(
component: any,
options: MountOptions<HooksConfig, never> & { props: Props }
): Promise<MountResult<Props>>;
Expand Down
16 changes: 11 additions & 5 deletions packages/playwright-ct-vue2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ type JsonObject = { [Key in string]?: JsonValue };

type Slot = string | string[];

export interface MountOptions<HooksConfig extends JsonObject, Props extends JsonObject> {
export interface MountOptions<
HooksConfig extends JsonObject,
Props extends Record<string, unknown>
> {
props?: Props;
slots?: Record<string, Slot> & { default?: Slot };
on?: Record<string, Function>;
hooksConfig?: HooksConfig;
}

interface MountResult<Props extends JsonObject> extends Locator {
interface MountResult<Props extends Record<string, unknown>> extends Locator {
unmount(): Promise<void>;
update(options: Omit<MountOptions<never, Props>, 'hooksConfig'>): Promise<void>;
}
Expand All @@ -62,9 +65,12 @@ export interface ComponentFixtures {
mount(component: JSX.Element): Promise<MountResultJsx>;
mount<HooksConfig extends JsonObject>(
component: any,
options?: MountOptions<HooksConfig, JsonObject>
): Promise<MountResult<JsonObject>>;
mount<HooksConfig extends JsonObject, Props extends JsonObject = JsonObject>(
options?: MountOptions<HooksConfig, Record<string, unknown>>
): Promise<MountResult<Record<string, unknown>>>;
mount<
HooksConfig extends JsonObject,
Props extends Record<string, unknown> = Record<string, unknown>
>(
component: any,
options: MountOptions<HooksConfig, never> & { props: Props }
): Promise<MountResult<Props>>;
Expand Down

0 comments on commit c132756

Please sign in to comment.