gaoletian/nuxt-ts-pont-demo

使用ElementUI作为UI组件库,$loading”的类型冲突

Closed this issue · 2 comments

问题:使用ElementUI作为UI组件库,使用npm run dev启动项目时,报如下错误

ERROR in /node_modules/@nuxt/vue-app/types/index.d.ts中 
Interface 'NuxtApp' incorrectly extends interface 'Vue'.
  Types of property '$loading' are incompatible.
    Type 'NuxtLoading' is not assignable to type '(options: LoadingServiceOptions) => ElLoadingComponent'.
      Type 'NuxtLoading' provides no match for the signature '(options: LoadingServiceOptions): ElLoadingComponent'.
    80 |   start(): NuxtLoading;
    81 | }
  > 82 | export interface NuxtApp extends Vue {
       |                  ^
    83 |   $loading: NuxtLoading;
    84 |   isOffline: boolean;
    85 |   isOnline: boolean;

@nuxt/vue-app的类型定义和 element-ui 的类型定义冲突

临时解决方案 配置 tsconfig.json

"compilerOptions": {
    "skipLibCheck": true
}

nuxt3.0版本会修复这个问题

https://github.com/nuxt/nuxt.js/issues/4877#issuecomment-475986809

最新版本的