1

In our yarn multi workspace project we get a very strange typescript build exception with the latest version of vue:

TS2345: Argument of type 'Router' is not assignable to parameter of type 'Plugin_2'.
  Type 'Router' is not assignable to type '{ install: PluginInstallFunction; }'.
    Types of property 'install' are incompatible.
      Type '(app: App<any>) => void' is not assignable to type 'PluginInstallFunction'.
        Types of parameters 'app' and 'app' are incompatible.
          Type 'import("/node_modules/@vue/runtime-core/dist/runtime-core").App<any>' is not assignable to type 'import("/node_modules/@vue/runtime-core/dist/runtime-core").App<any>'.

To me it does look, like they are identicall...

The relevant parts of the package.json:

{
   "dependencies": {
     "vue": "^3.2.31",
     "vue-router": "4.0.12",
     "@typescript-eslint/eslint-plugin": "^4.18.0",
     "@typescript-eslint/parser": "^4.18.0",
     "ts-node": "^8.10.2",
     "typescript": "~4.1.5"
   }
}

Anybody had this before and knows maybe how to fix it without going through the lengthy process of opening vue core tickets?

3 Answers 3

5

We'll it looks like an oddity of yarn...

We upgraded now all dependencies of vue to "vue": "^3.2.29" and the error is gone.

Sign up to request clarification or add additional context in comments.

1 Comment

I was on vue 3.2.45, upgraded to 3.2.47 and it worked as well. Seems like a yarn oddity indeed.
3

In my case, the error appeared when installing Element plus UI. And I decided to set the type "types": ["element-plus/global"] in tsconfig.json

Update: It is just as easy to solve a problem of the specified type as any. I do not know how correct this is, but the typescript does not always show an error. For example: createApp(App).use(i18n as any).use(ElementPlus).use(router as any).use(createPinia() as any).mount('#app')

1 Comment

I would not put too much trust in "as any", perhaps as a temorary solution tho
1

In my case, I discovered different versions of Vue between the app and the plugin.

The app installed [email protected], and the plugin installed [email protected], and with another plugin [email protected].

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.