Skip to content

[vue-component-meta] JSDoc tags in defineEmits are not included in generated EventMeta #5341

Open
@oljc

Description

@oljc

Vue version

3.5.13

TypeScript version

5.8.3

Steps to reproduce

Define defineEmits in Vue’s <script setup> syntax as follows:

const emit = defineEmits<{
  /**
   * @zh 点击时触发
   * @en Emitted when the link is clicked
   */
  (e: 'click', ev: MouseEvent): void;
  /**
   * @zh 用户点击链接时触发
   * @en Triggered when the user clicks on the link
   */
  (e: 'select', hash: string | undefined, preHash: string): void;
}>();
Image

Parse the output:

[
  {
    name: 'click',
    description: '',
    tags: [],
    type: '[ev: MouseEvent]',
    rawType: undefined,
    signature: '(event: "click", ev: MouseEvent): void',
    declarations: [Getter],
    schema: [Getter]
  },
  {
    name: 'select',
    description: '',
    tags: [],
    type: '[hash: string, preHash: string]',
    rawType: undefined,
    signature: '(event: "select", hash: string, preHash: string): void',
    declarations: [Getter],
    schema: [Getter]
  }
]

What is expected?

Tags in JSDoc comments for defineEmits should be extracted correctly, just like they are for Props.

What is actually happening?

does not correctly extract tags from JSDoc comments when parsing components.

Link to minimal reproduction

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions