microsoft / microsoft/TypeScript

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

Offen
#63,695 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit nachzuverfolgen, wie vorhandene Modulbeschreibungen gesammelt und im Hover angezeigt werden, und untersuche anschließend die JSDoc-Verarbeitung und die Autocomplete-Pfade. Ermittle, wie die Tags @file, @fileoverview und @overview ein Modul ohne declare module identifizieren sollen. Erledigt ist die Aufgabe, wenn Modulbeschreibungen für das gezeigte Exportmuster funktionieren und konsistent in Hover und Autocomplete erscheinen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
developer-experience, documentation
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.