Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Vue3 - Argument of type 'typeof import("../dist/vue")' is not assignable to parameter of type 'PublicAPIComponent'

I install vue using the cli v4.4.1.

After that I run this command to update to Vue3: vue add vue-next .

And when I open main.ts I get typescript error:

Argument of type 'typeof import("c:/../vue-app/node_modules/vue/dist/vue")' is not assignable to parameter of type 'PublicAPIComponent'.

What I need to do to solve this error?

enter image description here

like image 397
Jon Sud Avatar asked Jun 05 '20 13:06

Jon Sud


1 Answers

I solved the issue by updating the definition file for *.vue modules in src/shims-vue.d.ts with the following:

declare module "*.vue" {
  import { defineComponent } from "vue";
  const component: ReturnType<typeof defineComponent>;
  export default component;
}

source: https://dev.to/lmillucci/building-a-vue-3-component-with-typescript-4pge

like image 78
DWJ Avatar answered Nov 01 '22 07:11

DWJ