chore(ct): vue prop type of JsonObject (#21400)

This commit is contained in:
Sander 2023-03-06 17:58:56 +01:00 committed by GitHub
parent 86ca7e3949
commit 872b8ddbdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 26 deletions

View File

@ -41,19 +41,14 @@ type JsonObject = { [Key in string]?: JsonValue };
type Slot = string | string[];
export interface MountOptions<
HooksConfig extends JsonObject,
Props extends Record<string, unknown>
> {
export interface MountOptions<HooksConfig extends JsonObject, Props extends JsonObject> {
props?: Props;
slots?: Record<string, Slot> & { default?: Slot };
on?: Record<string, Function>;
hooksConfig?: HooksConfig;
}
interface MountResult<
Props extends Record<string, unknown>
> extends Locator {
interface MountResult<Props extends JsonObject> extends Locator {
unmount(): Promise<void>;
update(options: Omit<MountOptions<never, Props>, 'hooksConfig'>): Promise<void>;
}
@ -67,12 +62,9 @@ export interface ComponentFixtures {
mount(component: JSX.Element): Promise<MountResultJsx>;
mount<HooksConfig extends JsonObject>(
component: any,
options?: MountOptions<HooksConfig, Record<string, unknown>>
): Promise<MountResult<Record<string, unknown>>>;
mount<
HooksConfig extends JsonObject,
Props extends Record<string, unknown> = Record<string, unknown>
>(
options?: MountOptions<HooksConfig, JsonObject>
): Promise<MountResult<JsonObject>>;
mount<HooksConfig extends JsonObject, Props extends JsonObject = JsonObject>(
component: any,
options: MountOptions<HooksConfig, never> & { props: Props }
): Promise<MountResult<Props>>;

View File

@ -41,19 +41,14 @@ type JsonObject = { [Key in string]?: JsonValue };
type Slot = string | string[];
export interface MountOptions<
HooksConfig extends JsonObject,
Props extends Record<string, unknown>
> {
export interface MountOptions<HooksConfig extends JsonObject, Props extends JsonObject> {
props?: Props;
slots?: Record<string, Slot> & { default?: Slot };
on?: Record<string, Function>;
hooksConfig?: HooksConfig;
}
interface MountResult<
Props extends Record<string, unknown>
> extends Locator {
interface MountResult<Props extends JsonObject> extends Locator {
unmount(): Promise<void>;
update(options: Omit<MountOptions<never, Props>, 'hooksConfig'>): Promise<void>;
}
@ -67,12 +62,9 @@ export interface ComponentFixtures {
mount(component: JSX.Element): Promise<MountResultJsx>;
mount<HooksConfig extends JsonObject>(
component: any,
options?: MountOptions<HooksConfig, Record<string, unknown>>
): Promise<MountResult<Record<string, unknown>>>;
mount<
HooksConfig extends JsonObject,
Props extends Record<string, unknown> = Record<string, unknown>
>(
options?: MountOptions<HooksConfig, JsonObject>
): Promise<MountResult<JsonObject>>;
mount<HooksConfig extends JsonObject, Props extends JsonObject = JsonObject>(
component: any,
options: MountOptions<HooksConfig, never> & { props: Props }
): Promise<MountResult<Props>>;