Skip to content

Support @hideconstructor JSDoc tag to hide constructors from classes. #2577

Closed
@typhonrt

Description

@typhonrt

For classes that have only static methods presently there is no clean way to prevent TypeDoc from adding a default constructor to docs generated. This feature proposal suggests that the JSDoc tag @hideconstructor is useful. There is not an equivalent tag in TSDoc as far as I'm aware.

/**
 * This class should not be constructed as it only contains static methods.
 * 
 * @hideconstructor
 */
export class StaticClass {
   static foo() { ... }
}

This tag can also be applied on constructors as well per the JSDoc description.


TSC won't output default constructors even if they have comments / JSDoc attached to them.

The only non-clean workaround that I've found is to provide a constructor with a parameter and use the @hidden tag to remove it from documentation. This is very non-clean because in generated type declarations the dummy constructor is exposed.


I can take a look at a PR for this if you are too busy as this feature improves the API docs for libraries I release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions