cherry-pick(#22005): fix(ct): vue revert json object as prop (#22039)

Original PR: https://github.com/microsoft/playwright/pull/22005
References https://github.com/microsoft/playwright/issues/22003
This commit is contained in:
Yury Semikhatsky 2023-03-28 15:50:55 -07:00 committed by GitHub
parent 847b546794
commit c132756306
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 10 deletions

View file

@ -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>;
}
@ -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>>;

View file

@ -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>;
}
@ -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>>;