Microsoft/TypeScript

Remove `@type` tag from hover info

Open

#57.819 aberto em 18 de mar. de 2024

Ver no GitHub
 (0 comments) (2 reactions) (0 assignees)TypeScript (6.726 forks)batch import
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

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

Guia do colaborador