Experience EnhancementHelp WantedSuggestion
Métricas do repositório
- Stars
- (48.455 stars)
- Métricas de merge de PR
- (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)
Description
🔍 Search Terms
jsdoc tag @type remove
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
TypeScript should strip the @type JSDoc annotation from the description in tooltips such as hover information and autocompletion.
TypeScript already strips type information from other JSDoc tags such as @typedef, @property, @param, and @returns, but not for @type. For example, try hovering over various tokens in this playground.
📃 Motivating Example
TypeScript already stripped type information in various JSDoc tags in editor descriptions. Now it also strips the @type tag.
Try it in this playground
/**
* @typedef Person
* Person description.
*
* @property {string} name
* Name description.
*/
/**
* Variable description.
*
* @type {string}
*/
let variable;
/**
* @param {string} param
* Param description.
* @returns {string}
* Return value description.
*/
function fn(param) {
return param
}
💻 Use Cases
- What do you want to use this for? To provide a better DX for libraries developed in JSDoc.
- What shortcomings exist with current approaches?
The inclusion of the
@typetag in descriptions looks weird. Also the information is shown twice, as TypeScript also shows the processed type information. - What workarounds are you using in the meantime? There aren’t any.