🔍 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
- What do you want to use this for?
I would describe modules. It would be nice to generate documentation from source as well.
- What shortcomings exist with current approaches?
It can’t be done without declare module.
- What workarounds are you using in the meantime?
I don’t document modules.
🔍 Search Terms
fileoverview✅ Viability Checklist
⭐ Suggestion
JSDoc supports the
@filetag to document a file (module). Synonyms are@fileoverviewand@overview.Currently TypeScript allows you to document a module like this:
This description shows up when you hover over an import of
some-module.However, it’s generally considered more idiomatic avoid
declare module:In this case, there’s not way to describe the module.
I believe the
@filetag provides a perfect way to describe a module. So the following code would be equivalent to the original example above.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
@filetag to describe a module.💻 Use Cases
I would describe modules. It would be nice to generate documentation from source as well.
It can’t be done without
declare module.I don’t document modules.