question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript error on quasar upgrade.

See original GitHub issue

Describe 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:

  1. started with code on quasar 2.12.
  2. upgrade via quasar upgrade -i.
  3. 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pstaabpcommented, Oct 31, 2021

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.

0reactions
pstaabpcommented, Oct 31, 2021

Yes. It was the lock file. Thanks. Maybe detecting some of this in the quasar cli would help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supporting TypeScript - Quasar Framework
The following steps are only required when you have not selected TypeScript support when creating a fresh Quasar project. If you selected the...
Read more >
How can I fix quasar typescript file type error - Stack Overflow
I got a type error when I code file upload. Below is my code. Type error occurs in the parameter of the form.append()...
Read more >
@quasar/app-vite - npm
@quasar/app-vite. TypeScript icon, indicating that this package has built-in type declarations. 1.1.3 • Public • Published 2 months ago.
Read more >
Error with TypeScript in Quasar
Today after creating several projects last week without any error when I ... Did you upgrade any deps , local or global related...
Read more >
Upgrading to Quasar V2 - Dependencies, Removing CLI ...
We'll start going through the guide, and run into some upgrade errors along the way!...This gives me a chance to share some Vue3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found