# 一.报错

前言

# 1.TS2345

  • TS2345: Argument of type 'typeof import("/xxx/node_modules/vue/dist/vue")' is not assignable to parameter of type 'Component<any, any, any, ComputedOptions, MethodOptions, {}, any>'.
declare module "*.vue" {
  import type { DefineComponent } from "vue"
  const component: DefineComponent<{}, {}, any>
  export default component
}
1
2
3
4
5

# 2.ts7006

  • 参数“Vue”隐式具有“any”类型。ts(7006)
declare module '*.vue' {
    import { ComponentOptions } from 'vue'
    const componentOptions: ComponentOptions
    export default componentOptions
}
1
2
3
4
5