Skip to content

Vue-component-meta | Can't generate defineModel description and tags #4592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Fedezable opened this issue Jul 17, 2024 · 2 comments · Fixed by #5211
Closed

Vue-component-meta | Can't generate defineModel description and tags #4592

Fedezable opened this issue Jul 17, 2024 · 2 comments · Fixed by #5211

Comments

@Fedezable
Copy link

Fedezable commented Jul 17, 2024

Vue - Official extension or vue-tsc version

2.0.22

VSCode version

1.90.2

Vue version

3.4.30

TypeScript version

5.5.2

System Info

  Binaries:
    Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (126.0.2592.102)
    Internet Explorer: 11.0.22621.3527

Steps to reproduce

Create a basic script setup ts component with defineModel and generate meta.

<script setup lang="ts">
/**
 * Prop description
 *
 * @tag Tag
 */
defineModel<string>('data')
</script>

<template>
  <div>
    {{ data }}
  </div>
</template>

What is expected?

I'd expect the JSdoc comment associated to defineModel to be assigned to the prop, or alternatively to both the prop and the event.

What is actually happening?

Both prop and event are generated, but still the metadata from JSdoc can't be processed. Description and tags are both empty.

The prop generated:

{
    name: 'data',
    global: false,
    description: '',
    tags: [],
    required: false,
    type: 'string | undefined',
    rawType: undefined,
    declarations: [Getter],
    schema: [Getter]
}

The event generated:

{
    name: 'update:data',
    description: '',
    tags: [],
    type: '[data: string]',
    rawType: undefined,
    signature: '(event: "update:data", data: string): void',
    declarations: [Getter],
    schema: [Getter]
}

Link to minimal reproduction

No response

Any additional comments?

No response

@Fedezable Fedezable changed the title Can't generate defineModel description and tags Vue-component-meta | Can't generate defineModel description and tags Jul 17, 2024
@davidmatter
Copy link
Collaborator

What are you using to generate the JSDoc?

@kermanx kermanx added enhancement New feature or request and removed need info labels Aug 13, 2024
@liangpengyv
Copy link

I encountered a similar issue:

The JSDoc description for defineProps can be retrieved normally.

However, the JSDoc description for defineEmits cannot be retrieved properly.


My component code:

<script setup lang="ts">
interface Props {
  /**
   * 卡片的 title        <-- JSDoc description info of props...
   */
  title?: string
}
defineProps<Props>()

interface Emits {
  /**
   * 卡片的 showMessage        <-- JSDoc description info of emits...
   */
  showMessage: [msg: string]
}
const emits = defineEmits<Emits>()
</script>

I got:

image


Is this an unknown bug in the vue-component-meta package, or is it designed this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants