microsoft / microsoft/TypeScript

Add support for `@file` jsdoc tag to describe a module

オープン
#63,695 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

🔍 Search Terms

fileoverview

✅ Viability Checklist
⭐ Suggestion

JSDoc supports the @file tag to document a file (module). Synonyms are @fileoverview and @overview.

Currently TypeScript allows you to document a module like this:

/**
 * This comment describes `some-module`.
 */
declare module 'some-module' {
  /**
   * This comment describes `fn`.
   */
  export function fn(): unknown;
}

This description shows up when you hover over an import of some-module.

However, it’s generally considered more idiomatic avoid declare module:

/**
 * This comment describes `fn`.
 */
export function fn(): unknown;

In this case, there’s not way to describe the module.

I believe the @file tag provides a perfect way to describe a module. So the following code would be equivalent to the original example above.

/**
 * @file
 * This comment describes `some-module`.
 */

/**
 * This comment describes `fn`.
 */
export function fn(): unknown;

I noticed that current module descriptions show up on hover, but not in autocomplete. I believe it would be nice to add support for that too.

📃 Motivating Example

TypeScript now supports the @file tag to describe a module.

💻 Use Cases
  1. What do you want to use this for?

I would describe modules. It would be nice to generate documentation from source as well.

  1. What shortcomings exist with current approaches?

It can’t be done without declare module.

  1. What workarounds are you using in the meantime?

I don’t document modules.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、既存のモジュール説明がどのように収集され、hover に表示されるかを追跡し、次に JSDoc の処理と autocomplete の経路を調査します。@file、@fileoverview、@overview タグが declare module なしでモジュールをどのように識別すべきかを確認します。示されているエクスポートパターンでモジュール説明が機能し、hover と autocomplete に一貫して表示されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
developer-experience, documentation
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。