Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update types #25538

Merged
merged 2 commits into from
Jan 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 65 additions & 55 deletions npm/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const cleanup = () => {
* `MountOptions` are modifying, including some Cypress specific options like `styles`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just followed the instructions above here (line 85-94) to fix it. Just copy paste the latest types.

* The return type is different. Instead of VueWrapper, it's Cypress.Chainable<VueWrapper<...>>.
*/

type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps

type ComponentMountingOptions<T> = T extends DefineComponent<
Expand Down Expand Up @@ -206,46 +207,47 @@ export function mount<
> &
Record<string, any>
): Cypress.Chainable<{

wrapper: VueWrapper<
InstanceType<
DefineComponent<
PropsOrPropOptions,
RawBindings,
D,
C,
M,
Mixin,
Extends,
E,
EE,
PP,
Props,
Defaults
>
InstanceType<
DefineComponent<
PropsOrPropOptions,
RawBindings,
D,
C,
M,
Mixin,
Extends,
E,
EE,
PP,
Props,
Defaults
>
>
>
component: VueWrapper<
InstanceType<
DefineComponent<
PropsOrPropOptions,
RawBindings,
D,
C,
M,
Mixin,
Extends,
E,
EE,
PP,
Props,
Defaults
>
InstanceType<
DefineComponent<
PropsOrPropOptions,
RawBindings,
D,
C,
M,
Mixin,
Extends,
E,
EE,
PP,
Props,
Defaults
>
>['vm']}
>
>
>['vm']
}>

// component declared by vue-tsc ScriptSetup
export function mount<T extends DefineComponent<any, any, any, any>>(
export function mount<T extends DefineComponent<any, any, any, any, any>>(
component: T,
options?: ComponentMountingOptions<T>
): Cypress.Chainable<{
Expand Down Expand Up @@ -278,9 +280,17 @@ export function mount<
>,
options?: MountingOptions<Props & PublicProps, D>
): Cypress.Chainable<{
wrapper: VueWrapper<ComponentPublicInstance<Props, RawBindings, D, C, M, E, VNodeProps & Props>>
component: VueWrapper<ComponentPublicInstance<Props, RawBindings, D, C, M, E, VNodeProps & Props>>['vm']
}> & Record<string, any>
wrapper: VueWrapper<

ComponentPublicInstance<Props, RawBindings, D, C, M, E, VNodeProps & Props>
> &
Record<string, any>
component: VueWrapper<

ComponentPublicInstance<Props, RawBindings, D, C, M, E, VNodeProps & Props>
> &
Record<string, any>['vm']
}>

// Component declared with { props: [] }
export function mount<
Expand Down Expand Up @@ -343,27 +353,27 @@ export function mount<
options?: MountingOptions<ExtractPropTypes<PropsOptions> & PublicProps, D>
): Cypress.Chainable<{
wrapper: VueWrapper<
ComponentPublicInstance<
ExtractPropTypes<PropsOptions>,
RawBindings,
D,
C,
M,
E,
VNodeProps & ExtractPropTypes<PropsOptions>
>
ComponentPublicInstance<
ExtractPropTypes<PropsOptions>,
RawBindings,
D,
C,
M,
E,
VNodeProps & ExtractPropTypes<PropsOptions>
>
>
component: VueWrapper<
ComponentPublicInstance<
ExtractPropTypes<PropsOptions>,
RawBindings,
D,
C,
M,
E,
VNodeProps & ExtractPropTypes<PropsOptions>
>
>['vm']
ComponentPublicInstance<
ExtractPropTypes<PropsOptions>,
RawBindings,
D,
C,
M,
E,
VNodeProps & ExtractPropTypes<PropsOptions>
>
>['vm']
}>

/**
Expand Down