You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When using defineEmits with TypeScript type syntax and JSDoc comments, the emitted .d.ts files discard all JSDoc documentation for emits while correctly preserving them for props. This significantly impacts developer experience as emit events lose their documentation in the generated type definitions.
The solution would involve modifying vue-tsc's type declaration emitter to preserve JSDoc comments for defineEmits types, similar to how it already works for defineProps.
Technical Implementation Expectations:
TypeScript AST Handling
The emitter should retain JSDoc nodes attached to emit event signatures in the TypeScript AST when generating .d.ts files.
Output Format
The generated declarations should mirror the input's documentation structure:
Description:
When using
defineEmits
with TypeScript type syntax and JSDoc comments, the emitted.d.ts
files discard all JSDoc documentation for emits while correctly preserving them for props. This significantly impacts developer experience as emit events lose their documentation in the generated type definitions.Environment:
Reproduction Steps:
Run
vue-tsc --declaration --emitDeclarationOnly
Observe generated
.d.ts
file:(Notice JSDoc is missing)
Proposed Solution
The solution would involve modifying
vue-tsc
's type declaration emitter to preserve JSDoc comments fordefineEmits
types, similar to how it already works fordefineProps
.Technical Implementation Expectations:
TypeScript AST Handling
The emitter should retain JSDoc nodes attached to emit event signatures in the TypeScript AST when generating
.d.ts
files.Output Format
The generated declarations should mirror the input's documentation structure:
Consistency with Props
The behavior should match the existing JSDoc preservation for
defineProps
(which already works correctly).Additional Notes
Priority Areas
The fix should prioritize:
defineEmits<{...}>()
)/** comment */
) and@param
tagsBackward Compatibility
This change would be non-breaking, as it only adds documentation without affecting runtime behavior.
Testing Suggestions
Test cases should verify:
@param
)The text was updated successfully, but these errors were encountered: