Typescript error on quasar upgrade.
See original GitHub issueDescribe the bug
I have a substantial-sized project. I have just run quasar upgrade -i
and upgraded from 2.1.2 to 2.2.2. Now I’m getting the following error when either doing quasar dev
or quasar build
:
TS2345: Argument of type '() => Router' is not assignable to parameter of type 'RouteCallback<StateInterface>'.
Type 'Router' is not assignable to type 'Router | Promise<Router>'.
Type 'import("/opt/webwork/webwork3/node_modules/vue-router/dist/vue-router").Router' is not assignable to type 'import("/opt/webwork/webwork3/node_modules/@quasar/app/node_modules/vue-router/dist/vue-router").Router'.
The types returned by 'push(...)' are incompatible between these types.
Type 'Promise<void | import("/opt/webwork/webwork3/node_modules/vue-router/dist/vue-router").NavigationFailure | undefined>' is not assignable to type 'Promise<void | import("/opt/webwork/webwork3/node_modules/@quasar/app/node_modules/vue-router/dist/vue-router").NavigationFailure | undefined>'.
Type 'void | import("/opt/webwork/webwork3/node_modules/vue-router/dist/vue-router").NavigationFailure | undefined' is not assignable to type 'void | import("/opt/webwork/webwork3/node_modules/@quasar/app/node_modules/vue-router/dist/vue-router").NavigationFailure | undefined'.
Type 'NavigationFailure' is not assignable to type 'void | NavigationFailure | undefined'.
Type 'import("/opt/webwork/webwork3/node_modules/vue-router/dist/vue-router").NavigationFailure' is not assignable to type 'import("/opt/webwork/webwork3/node_modules/@quasar/app/node_modules/vue-router/dist/vue-router").NavigationFailure'.
Types of property 'type' are incompatible.
Type 'ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_DUPLICATED' is not assignable to type 'ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_DUPLICATED'. Two different types with this name exist, but they are unrelated.
Type 'ErrorTypes.NAVIGATION_ABORTED' is not assignable to type 'ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_DUPLICATED'.
This on on the src/router/index.ts
file.
Note: I created a new quasar project with quasar create
and checked all options (same as my current project). The src/router/index.ts
file is exactly the same.
Also, I have removed the node_modules
file and rebuilt with npm i
and still have the same error. Sometimes this seems to fix errors like this.
Codepen/jsFiddle/Codesandbox (required)
This occurs on an upgrade to an existing project and doesn’t cause an error on an MWE.
To Reproduce Steps to reproduce the behavior:
Again, since this is on an existing project on upgrade, I did:
- started with code on quasar 2.12.
- upgrade via
quasar upgrade -i
. - The error shown above occurs.
Expected behavior
The web pack to compile without error.
Screenshots If applicable, add screenshots to help explain your problem.
Platform (please complete the following information): Quasar Version: @quasar/app Version:
Quasar mode:
- SPA
- SSR
- PWA
- Electron
- Cordova
- Capacitor
- BEX
Tested on:
- SPA
- SSR
- PWA
- Electron
- Cordova
- Capacitor
- BEX
OS: MacOS 11.6.1 Node: v16.12.0 NPM: v8.1.0 Yarn: Browsers: iOS: Android: Electron:
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
FYI: I did remove vue-router from package.json, removed the node_modules directory and did a
npm i
to reinstall and got errors all over the place that vue-router didn’t exist. That’s why I had it in there.Yes. It was the lock file. Thanks. Maybe detecting some of this in the quasar cli would help.