Microsoft/TypeScript

Remove `@type` tag from hover info

开放

#57,819 创建于 2024年3月18日

 (0 条评论) (2 个反应) (0 位负责人)TypeScript (13,395 个派生)batch import
Experience EnhancementHelp WantedSuggestion

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南