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

Typescript error with functional component #579

Closed
tcastelly opened this issue Oct 29, 2020 · 1 comment
Closed

Typescript error with functional component #579

tcastelly opened this issue Oct 29, 2020 · 1 comment

Comments

@tcastelly
Copy link

Hi,

I have an error by defining a functional component in Typescript with the composition api:

import { defineComponent } from '@vue/composition-api';

export default defineComponent({
  functional: true,
});
Error:(14, 3) TS2769: No overload matches this call.
  Overload 1 of 3, '(options: ComponentOptionsWithoutProps<unknown, unknown, Data, {}, {}>): VueProxy<unknown, unknown, Data, {}, {}>', gave the following error.
    Argument of type '{ functional: boolean; }' is not assignable to parameter of type 'ComponentOptionsWithoutProps<unknown, unknown, Data, {}, {}>'.
      Object literal may only specify known properties, and 'functional' does not exist in type 'ComponentOptionsWithoutProps<unknown, unknown, Data, {}, {}>'.
  Overload 2 of 3, '(options: ComponentOptionsWithArrayProps<string, Data, Data, {}, {}, Readonly<{ [x: string]: any; }>>): VueProxy<Readonly<{ [x: string]: any; }>, Data, Data, {}, {}>', gave the following error.
    Argument of type '{ functional: boolean; }' is not assignable to parameter of type 'ComponentOptionsWithArrayProps<string, Data, Data, {}, {}, Readonly<{ [x: string]: any; }>>'.
      Object literal may only specify known properties, and 'functional' does not exist in type 'ComponentOptionsWithArrayProps<string, Data, Data, {}, {}, Readonly<{ [x: string]: any; }>>'.
  Overload 3 of 3, '(options: ComponentOptionsWithProps<ComponentPropsOptions<Data>, Data, Data, {}, {}, ({ [x: number]: string; } & { toString?: string; toLocaleString?: string; concat?: string[]; indexOf?: (searchElement: string, fromIndex?: number) => number; ... 25 more ...; values?: IterableIterator<...>; }) | ({} & { ...; })>): VueProxy<...>', gave the following error.
    Argument of type '{ functional: boolean; }' is not assignable to parameter of type 'ComponentOptionsWithProps<ComponentPropsOptions<Data>, Data, Data, {}, {}, ({ [x: number]: string; } & { toString?: string; toLocaleString?: string; concat?: string[]; indexOf?: (searchElement: string, fromIndex?: number) => number; ... 25 more ...; values?: IterableIterator<...>; }) | ({} & { ...; })>'.
      Object literal may only specify known properties, and 'functional' does not exist in type 'ComponentOptionsWithProps<ComponentPropsOptions<Data>, Data, Data, {}, {}, ({ [x: number]: string; } & { toString?: string; toLocaleString?: string; concat?: string[]; indexOf?: (searchElement: string, fromIndex?: number) => number; ... 25 more ...; values?: IterableIterator<...>; }) | ({} & { ...; })>'.

The same code works on Vue 3.

@seanaye
Copy link

seanaye commented Nov 2, 2020

I'm getting the same error

antfu added a commit to antfu/composition-api that referenced this issue Nov 2, 2020
@antfu antfu closed this as completed in 7cdf1e5 Nov 2, 2020
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

No branches or pull requests

2 participants