Skip to content

Return type confusing, generics not working #2314

Closed
@philly-vanilly

Description

const wrapper: ReturnType<typeof mount<SomeComponent>> = mount(SomeComponent);

This is giving me the error ComponentPublicInstance<{}, Omit<{ value: string; }, never>> is not assignable to type
ComponentPublicInstance<NonNullable<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly<ExtractPropTypes<{}>>, never>>, { ...; } & ... 6 more ... & Omit<...>>

What am I doing wrong? The type can of course be resolved automatically, but only if you directly assing it to. constant. if you want to have a wrapper defined but not immediately assigned (which happens later in beforeEach), this leads to type errors.

I guess the best practices are to not create the wrapper in beforeEach but in each test (?), but I have over 300 test-suites in a project I did not set up myself and I need to improve the type-safety without refactoring them all. I do not want ot use "any" for this.

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