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

Bug: Unable to pass props of a unioned type to mount since 2.4.2 #2294

Open
ascott18 opened this issue Jan 3, 2024 · 1 comment
Open

Bug: Unable to pass props of a unioned type to mount since 2.4.2 #2294

ascott18 opened this issue Jan 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ascott18
Copy link
Contributor

ascott18 commented Jan 3, 2024

Describe the bug

Starting in 2.4.2 (works in 2.4.1), when passing props to mount whose type is a union, a type error is raised.

Type '{ foo: string; } | { foo: { bar: string; }; }' is not assignable to type 'VNodeProps & { __v_isVNode?: never; [Symbol.iterator]?: never; } & Record<string, any> & { foo: string; }'.
  Type '{ foo: { bar: string; }; }' is not assignable to type 'VNodeProps & { __v_isVNode?: never; [Symbol.iterator]?: never; } & Record<string, any> & { foo: string; }'.
    Type '{ foo: { bar: string; }; }' is not assignable to type '{ foo: string; }'.
      Types of property 'foo' are incompatible.
        Type '{ bar: string; }' is not assignable to type 'string'.(2322)

To Reproduce
https://stackblitz.com/edit/github-wh8w7t?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts

Expected behavior
A type error is not raised, as is the case in 2.4.1 and below.

Same repro with 2.4.1: https://stackblitz.com/edit/github-wh8w7t-gbvna2?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts

Related information:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  npmPackages:
    @vue/test-utils: ^2.4.3 => 2.4.3 
    vitest: ^1.0.4 => 1.1.1 
    vue: ^3.3.11 => 3.4.4 

Additional context

@ascott18 ascott18 added the bug Something isn't working label Jan 3, 2024
@cexbrayat
Copy link
Member

Hi @ascott18 , thanks for the repro

We have a WIP PR from @pikax that will probably help with this issue.
Watch #2242 if you're interested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants