Skip to content

Cannot write the type safe functional component test case. #1426

Closed
@kahirokunn

Description

@kahirokunn

Version

1.0.0-beta.31

Reproduction link

https://gist.github.com/kahirokunn/a15c911cbad33082afb41cc861524c2d

Steps to reproduce

Just inject generics to FunctionalComponentOptions
ex: FunctionalComponentOptions<{ tag: string }>

What is expected?

no type error

What is actually happening?

I got type error


No overload matches this call.
Overload 1 of 3, '(component: VueClass, options?: ThisTypedShallowMountOptions): Wrapper', gave the following error.
型 'FunctionalComponentOptions<{ tag: string; }, PropsDefinition<{ tag: string; }>>' の引数を型 'VueClass' のパラメーターに割り当てることはできません。
型 'FunctionalComponentOptions<{ tag: string; }, PropsDefinition<{ tag: string; }>>' を型 'new (...args: any[]) => Vue' に割り当てることはできません。
型 'FunctionalComponentOptions<{ tag: string; }, PropsDefinition<{ tag: string; }>>' にはシグネチャ 'new (...args: any[]): Vue' に一致するものがありません。
Overload 2 of 3, '(component: ComponentOptions<Vue, DefaultData, DefaultMethods, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>, options?: ThisTypedShallowMountOptions<...>): Wrapper<...>', gave the following error.
型 'FunctionalComponentOptions<{ tag: string; }, PropsDefinition<{ tag: string; }>>' の引数を型 'ComponentOptions<Vue, DefaultData, DefaultMethods, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>' のパラメーターに割り当てることはできません。
プロパティ 'props' の型に互換性がありません。
型 'PropsDefinition<{ tag: string; }>' を型 'PropsDefinition<Record<string, any>>' に割り当てることはできません。
型 'ArrayPropsDefinition<{ tag: string; }>' を型 'PropsDefinition<Record<string, any>>' に割り当てることはできません。
型 'ArrayPropsDefinition<{ tag: string; }>' を型 'ArrayPropsDefinition<Record<string, any>>' に割り当てることはできません。
Property 'tag' is missing in type 'Record<string, any>' but required in type '{ tag: string; }'.
Overload 3 of 3, '(component: FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>, options?: ShallowMountOptions): Wrapper<...>', gave the following error.
型 'FunctionalComponentOptions<{ tag: string; }, PropsDefinition<{ tag: string; }>>' の引数を型 'FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>' のパラメーターに割り当てることはできません。
型 'PropsDefinition<{ tag: string; }>' を型 'PropsDefinition<Record<string, any>>' に割り当てることはできません。
型 'ArrayPropsDefinition<{ tag: string; }>' を型 'PropsDefinition<Record<string, any>>' に割り当てることはできません。
型 'ArrayPropsDefinition<{ tag: string; }>' を型 'ArrayPropsDefinition<Record<string, any>>' に割り当てることはできません。ts(2769)
helloWorld.spec.ts(12, 61): 'tag' is declared 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