-
Notifications
You must be signed in to change notification settings - Fork 344
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
Component created with createComponent() throws a type error when used in a render function #35
Comments
Yeah, I've got rid of the error by modifying the import Vue, { ComponentOptions, VueConstructor } from 'vue';
import { Context } from '../types/vue';
export declare type PropType<T> = T;
declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
declare type ComponentOptionsWithSetup<Props> = Omit<ComponentOptions<Vue>, 'props' | 'setup'> & {
props?: Props;
setup?: (this: undefined, props: {
[K in keyof Props]: Props[K];
}, context: Context) => object | null | undefined | void;
};
export declare function createComponent<Props>(compOpions: ComponentOptionsWithSetup<Props>): ComponentOptions<Vue> & VueConstructor<Vue>;
export {}; Typescript expects something like the |
This works, but now I receive an error on props saying the types are not assignable to type |
@IceSentry Try the v2.2.0 |
With 2.2.0 createComponent asks for a
I'm probably doing something wrong, but I don't really have time to thinker with it and figure out what's wrong. I'll give a better bug report later this week. |
@liximomo @IceSentry I got the same typing error when using a component created by
|
The typing error shown above is actually caused by the hack given in #63 (comment). @IceSentry Without the hack the JSX typing is all fine. |
I personally did not try the hack so I assumed it was related but not the same thing. Either way, it's pretty obvious at this point that the typing for |
This sandbox reproduces the error I get in App.tsx
https://codesandbox.io/s/vue-function-api-typescript-issue-vrycw
For some reason the sandbox fails to import the components, but the code actually works when opened in vscode.
The code actually works without issue, it's just that typescript complains that
JSX element type 'HelloWorld' does not have any construct or call signatures.
when using a component declared with createComponent and a render functionThe text was updated successfully, but these errors were encountered: