Vue-component-meta | Can't generate defineModel description and tags
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
What are you using to generate the JSDoc?
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:
Is this an unknown bug in the vue-component-meta package, or is it designed this way?