Skip to content

[Bug] Components exported by GlobalComponents interface have no type hints #3107

@Trezedo

Description

@Trezedo

Enviroments & packages:

  • VS Code: 1.77.3
  • Volar: 1.6.3
  • vue-tsc: 1.6.3
  • vue: 3.2.47
  • typescript: 5.0.4

Description

Actually I'm using unplugin-vue-components/vite to generate dts file:

// src/components.d.ts
export {};
declare module '@vue/runtime-core' {
  export interface GlobalComponents {
    MyUpload: typeof import('./components/MyUpload/index.vue')['default'];
  }
}

The type of component we obtain is any:
image

However, when we change '@vue/runtime-core' to 'vue', the type hinting works correctly:

- declare module '@vue/runtime-core' {
+ declare module 'vue' {

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions