Skip to content

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

Open
@ascott18

Description

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions