Microsoft/TypeScript

Remove `@type` tag from hover info

Open

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

在 GitHub 查看
 (0 评论) (2 反应) (0 负责人)TypeScript (6,726 fork)batch import
Experience EnhancementHelp WantedSuggestion

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 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.

贡献者指南