microsoft / microsoft/TypeScript
JSDoc comments emitted a second time even after commenrs on type are emitted
オープン
まだ誰も着手していません。
Bug
Domain: Comment Emit
Help Wanted
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
🔎 Search Terms
JSDoc, emit, comments
🕗 Version & Regression Information
v5.9.2
- I was unable to test this on prior versions because I was not using TS.
⏯ Playground Link
No response
💻 Code
/**
* The template passed to generate messages
*
* @callback Template
* @param {...*} args - Arguments to the template
* @returns {any} The generated message
*/
/**
* The arguments sent with notify become the input parameters for the template.
*
* @typedef {Parameters<Template>} TemplateParams
*/
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*
* @typedef {ReturnType<Template>} Message
*/
🙁 Actual behavior
Typescript, when emitting from JSDoc, seems to want to emit the same comments for a type declaration twice:
- once for the export (good) and
- once just copying over the JSDoc comment (bad).
/**
* The template passed to generate messages
*/
export type Template = (...args: any[]) => any;
/**
* The arguments sent with notify become the input parameters for the template.
*/
export type TemplateParams = Parameters<Template>;
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*/
export type Message = ReturnType<Template>;
/**
* The template passed to generate messages
*
* @callback Template
* @param {...*} args Arguments to the template
* @returns {any} The generated message
*/
/**
* The arguments sent with notify become the input parameters for the template.
*
* @typedef {Parameters<Template>} TemplateParams
*/
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*
* @typedef {ReturnType<Template>} Message
*/
🙂 Expected behavior
It should emit the comment just once:
/**
* The template passed to generate messages
*/
export type Template = (...args: any[]) => any;
/**
* The arguments sent with notify become the input parameters for the template.
*/
export type TemplateParams = Parameters<Template>;
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*/
export type Message = ReturnType<Template>;
or even better (See #61664)
/**
* The template passed to generate messages
*
* @param Arguments to the template
* @returns The generated message
*/
export type Template = (...args: any[]) => any;
/**
* The arguments sent with notify become the input parameters for the template.
*/
export type TemplateParams = Parameters<Template>;
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*/
export type Message = ReturnType<Template>;
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
TypeScript v5.9.2 を使い、提供された JavaScript/JSDoc スニペットで報告を再現してから、重複したコメントの原因となっている宣言出力パスを追跡します。生成された宣言に対するリグレッションテストを追加し、関連する #61664 の挙動を確認しながら、各コメントが1回だけ現れることを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100