Microsoft/TypeScript

Remove `@type` tag from hover info

Open

#57.819 aperta il 18 mar 2024

Vedi su GitHub
 (0 commenti) (2 reazioni) (0 assegnatari)TypeScript (6726 fork)batch import
Experience EnhancementHelp WantedSuggestion

Metriche repository

Star
 (48.455 star)
Metriche merge PR
 (Merge medio 6g 17h) (9 PR mergiate in 30 g)

Descrizione

🔍 Search Terms

jsdoc tag @type remove

✅ Viability Checklist

⭐ 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.

A tooltip from hovering over an @type annotated variable

A tooltip from hovering over a function

📃 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

  1. What do you want to use this for? To provide a better DX for libraries developed in JSDoc.
  2. What shortcomings exist with current approaches? The inclusion of the @type tag in descriptions looks weird. Also the information is shown twice, as TypeScript also shows the processed type information.
  3. What workarounds are you using in the meantime? There aren’t any.

Guida contributor