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

Type error using createComponent in a view imported to Router #193

Closed
ux-engineer opened this issue Nov 19, 2019 · 1 comment
Closed

Type error using createComponent in a view imported to Router #193

ux-engineer opened this issue Nov 19, 2019 · 1 comment

Comments

@ux-engineer
Copy link

Type error using createComponent function (using TypeScript) in a view component that is imported to Router:

21:30 Argument of type '{ mode: "history"; base: any; routes: ({ path: string; name: string; component: { name: string; components: { HelloWorld: VueConstructor<{ msg: string; } & Vue>; }; }; } | { path: string; name: string; component: VueProxy<...>; })[]; }' is not assignable to parameter of type 'RouterOptions'.    
  Types of property 'routes' are incompatible.
    Type '({ path: string; name: string; component: { name: string; components: { HelloWorld: VueConstructor<{ msg: string; } & Vue>; }; }; } | { path: string; 
name: string; component: VueProxy<ComponentPropsOptions<Data>, {}>; })[]' is not assignable to type 'RouteConfig[]'.
      Type '{ path: string; name: string; component: { name: string; components: { HelloWorld: VueConstructor<{ msg: string; } & Vue>; }; }; } | { path: string; name: string; component: VueProxy<ComponentPropsOptions<Data>, {}>; }' is not assignable to type 'RouteConfig'.
        Type '{ path: string; name: string; component: VueProxy<ComponentPropsOptions<Data>, {}>; }' is not assignable to type 'RouteConfig'.
          Types of property 'component' are incompatible.
            Type 'VueProxy<ComponentPropsOptions<Data>, {}>' is not assignable to type 'VueConstructor<Vue> | ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>> | AsyncComponentPromise<...> | AsyncComponentFactory<...> | undefined'.  
              Type 'ComponentOptions<Vue, {}, never, never, ComponentPropsOptions<Data>, ExtractPropTypes<ComponentPropsOptions<Data>, false>> & VueConstructorProxy<ComponentPropsOptions<Data>, {}>' is missing the following properties from type 'VueConstructor<Vue>': extend, nextTick, set, delete, and 9 more.
    19 | ]
    20 | 
  > 21 | const router = new VueRouter({
       |                              ^
    22 |   mode: 'history',
    23 |   base: process.env.BASE_URL,
    24 |   routes
Version: typescript 3.5.3

Minimal bug reproduction repo: https://github.com/ux-engineer/bug-composition-api-createcomponent-with-router

@posva
Copy link
Member

posva commented Nov 19, 2019

Duplicate of #185

@posva posva marked this as a duplicate of #185 Nov 19, 2019
@posva posva closed this as completed Nov 19, 2019
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