Skip to content

How to reference global types #68

@hairyf

Description

@hairyf

I added the following type:

export {}

declare module 'vue' {
  export interface GlobalComponents {
    MyButton: typeof import('./MyButton')['MyButton']
  }
}

When using it in a vue file, my-button is type unknown:

<template>
  <my-button> Click </my-button>
</template>
<my-button> Click </my-button>
    ↑
  type MyButton: unknown

But vscode can correctly identify types

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