microsoft / microsoft/TypeScript
Remove `@type` tag from hover info
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the hover information and autocompletion handling for JSDoc descriptions, comparing how existing tags such as @typedef, @property, @param, and @returns are stripped. Done means @type is omitted while the surrounding description remains, with the result checked in the linked TypeScript playground examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100