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

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

Closed
kahirokunn opened this issue Feb 4, 2020 · 0 comments · Fixed by #1427
Closed

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

kahirokunn opened this issue Feb 4, 2020 · 0 comments · Fixed by #1427

Comments

@kahirokunn
Copy link
Contributor

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.

@kahirokunn kahirokunn mentioned this issue Feb 4, 2020
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant