Prop comments not present in declaration file when prop has defaults
I've seen a couple issues for this (#1434, #1261, #703) which all indicate the issue is resolved yet I'm still seeing this problem when using vue-tsc to generate the types for a component library.
I ran npm init vue@latest to test this and created the following MyButton.vue component.
import type { PropType } from 'vue'
export type Variant = 'primary' | 'secondary' | 'success' | 'danger'
const props = defineProps({
/**
* The variant of the button.
*/
variant: {
type: String as PropType<Variant>,
default: 'primary',
},
})
When running vue-tsc --declaration --emitDeclarationOnly I get the following declaration file for the component:
import type { PropType } from 'vue';
export declare type Variant = 'primary' | 'secondary' | 'success' | 'danger';
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
/**
* The variant of the button.
*/
variant: {
type: PropType<Variant>;
default: string;
};
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
/**
* The variant of the button.
*/
variant: {
type: PropType<Variant>;
default: string;
};
}>>, {
variant: Variant;
}>, {
default: (_: {}) => any;
}>;
export default _default;
declare type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};
For whatever reason when I use this component in a project I don't see the JSDoc and Ctrl + Click takes me through to the line that has variant: Variant;.

I've also tried declaring props with withDefaults(defineProps<{}>()) but it yields the same result. As soon as the default is removed and the prop is marked as required the JSDoc comes through correctly.
Versions Vue: 3.2.47 Vite: 4.1.1 vue-tsc: 1.1.2
If there's any other information you'd need please let me know. I'm hoping this is just an oversight on my behalf. Cheers.
I think defineComponent have been change so the solutions of the past don't work.
I will see how to fix to types.
We are also running into this issue when trying to build an npm package of our component types (d.ts files). Did you ever make headway on finding a way to fix this? I'm happy to do some digging around on this, but not sure where to start looking. As in, I don't even know what if this is a core vue issue or a language-tools issue.
Same issue here. Is there any workaround to make it work?
This will be addressed by https://github.com/vuejs/core/pull/12935 in Vue 3.6.