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

Upgrading to TypeScript 3.7 yields vue-router type error with composition-api #3019

Open
aaf-ww opened this issue Nov 5, 2019 · 1 comment

Comments

@aaf-ww
Copy link

@aaf-ww aaf-ww commented Nov 5, 2019

Version

3.1.3

Reproduction link

https://github.com/aaf-ww/vue-router-typescript-bug

Steps to reproduce

Scaffold a new project with CLI (TypeScript/Babel/vue-router/etc), install @vue/composition-api then upgrade to TypeScript 3.7.2

vue create project-name (select all options)
npm install @vue/composition-api
npm update typescript@latest -D

What is expected?

No type errors.

What is actually happening?

ERROR in C:/Users/x/Desktop/source/vue-router-typescript-bug/src/router/index.ts(24,30):
24:30 Argument of type '{ mode: "history"; base: any; routes: ({ path: string; name: string; component: VueProxy<ComponentPropsOptions, Data>; } | { path: string; name: string; component: () => Promise<...>; })[]; }' is not assignable to parameter of type 'RouterOptions'.
Types of property 'routes' are incompatible.
Type '({ path: string; name: string; component: VueProxy<ComponentPropsOptions, Data>; } | { path: string; name: string; component: () => Promise<typeof import("C:/Users/x/Desktop/source/vue-router-typescript-bug/src/views/About.vue")>; })[]' is not assignable to type 'RouteConfig[]'.
Type '{ path: string; name: string; component: VueProxy<ComponentPropsOptions, Data>; } | { path: string; name: string; component: () => Promise<typeof import("C:/Users/x/Desktop/source/vue-router-typescript-bug/src/views/About.vue")>; }' 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 | ComponentOptions<Vue, DefaultData, DefaultMethods, DefaultComputed, PropsDefinition<...>, Record<...>> | AsyncComponentPromise<...> | AsyncComponentFactory<...> | undefined'.
Type 'ComponentOptions<Vue, { [x: string]: unknown; }, never, never, ComponentPropsOptions, ExtractPropTypes<ComponentPropsOptions, false>> & VueConstructorProxy<...>' is missing the following properties from type 'VueConstructor': extend, nextTick, set, delete, and 9 more.
22 | ];
23 |

24 | const router = new VueRouter({
| ^
25 | mode: "history",
26 | base: process.env.BASE_URL,
27 | routes
Version: typescript 3.7.2

@pippo46

This comment has been minimized.

Copy link

@pippo46 pippo46 commented Nov 20, 2019

I have the same issue. Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.