Skip to content

Support Vue 2.7.16 #2087

Open
Open
@baboon-king

Description

@baboon-king

Subject of the issue

Hi!
I doing this vuejs/create-vue#408

type definition not work with Vue 2.7.16

Steps to reproduce

  1. clone https://github.com/baboon-king/vue-test-utils-bug-miss-type-for-vue-2.7.16
  2. pnpm i
  3. pnpm run type-check
  4. focus terminal
xxxxx@XXXXXX-Air typescript-jsx-pinia-vitest-cypress % pnpm run type-check

> [email protected] type-check /Users/baboon/Downloads/create-vue-test/typescript-jsx-pinia-vitest-cypress
> vue-tsc --noEmit -p tsconfig.vitest.json --composite false

src/components/__tests__/HelloWorld.spec.ts:8:27 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Argument of type 'ComponentPublicInstanceConstructor<Vue3Instance<{}, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ msg: string; }>>>, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ msg: string; }>>>, {}, {}, true, ComponentOptionsBase<...>> & ... 4 more ... & Readonly<...>, ... 4 more ..., MethodOptions> & Com...' is not assignable to parameter of type 'ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>, ... 6 more ..., ComponentOptionsMixin>'.
      Type 'ComponentPublicInstanceConstructor<Vue3Instance<{}, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ msg: string; }>>>, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ msg: string; }>>>, {}, {}, true, ComponentOptionsBase<...>> & ... 4 more ... & Readonly<...>, ... 4 more ..., MethodOptions> & Com...' is missing the following properties from type 'VueConstructor<ExtractComputedReturns<{}> & DefaultProps & Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>> & ShallowUnwrapRef<...> & Vue<...>>': extend, nextTick, set, delete, and 10 more.

8     const wrapper = mount(HelloWorld, { propsData: { msg: 'Hello Vitest' } })
                            ~~~~~~~~~~

  node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue/test-utils/types/index.d.ts:195:25
    195 export declare function mount<V extends Vue, Props = DefaultProps> (component: ExtendedVue<V, {}, {}, {}, Props>, options?: FunctionalComponentMountOptions<V>): Wrapper<CombinedVueInstance<V, {}, {}, {}, Props> & Vue>
                                ~~~~~
    The last overload is declared here.


Found 1 error in src/components/__tests__/HelloWorld.spec.ts:8

 ELIFECYCLE  Command failed with exit code 2.

Expected behaviour

worked

Actual behaviour

not worked

Possible Solution

I try install @vue/[email protected]. but it only work with Vue 3. see vuejs/test-utils#2289

so, That's why I came here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions