Skip to content

Override JSDoc for re-exported types / enum / classes / interfacesΒ #42684

Description

Suggestion

πŸ” Search Terms

  • Override JSDoc
  • JSDoc for re-export

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Add the ability to define / override documentation(JSDoc) for re-exported types / enum / classes / interfaces, etc.

πŸ“ƒ Motivating Example

In the case when the library developer decided to change the name of the type / enum / class / interface, etc., it would be useful to have two copies of the declaration with different names and the old name would be marked as Daniel Edeling (@deprecated).
This refactoring practice is adopted for class methods, when a new method is created and the body of the old method is transferred into it, and a call to the new method is placed in the old method. The old method is then marked as Daniel Edeling (@deprecated) so that the library user has time to replace the name of the called method.

πŸ’» Use Cases

An example of overriding JSDoc to mark a enum / interface as deprecated

// file: core/newFeature.ts/** Some enum description **/exportenumNewFeatureEnum{// ...}/** Some interface description **/exportenumINewFeature<TextendsNewFeatureEnum>{// ...}// file: index.tsexport{NewFeatureEnum,/** @deprecated use NewFeatureEnum */NewFeatureEnumasOldFeatureEnum,INewFeature,/** @deprecated use INewFeature */INewFeatureasIOldFeature,// ...}from'core/newFeature';

At the moment, the JSDoc comment added to the re-export construct will not affect the final result in any way

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions