Skip to content

Global component intellisense in template #228

@ci010

Description

@ci010

Follow the instruction, I added the definition of a global component

import { Component } from 'vue'

interface MyPropTypes { 
  /**
   * document content
   */
  p: string
}

declare module 'vue' {
  export interface GlobalComponents {
    componentName: Component<MyPropTypes>
  }
}

export { }

In the vue template, it cannot have correct intellisense hint for this component,
but if I change it to DefineComponent

import { DefineComponent } from 'vue'

declare module 'vue' {
  export interface GlobalComponents {
    componentName: DefineComponent<MyPropTypes>
  }
}

export { }

it works, whereas the code navigation is wrong.

<template>
   <my-component :p="xxx" />
</template>

Go to definition not work for p (it works if I use Component), and it cannot show the document of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions