-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
Suggestion
π Search Terms
jsdoc internal jsdoc internal stripinternal
β 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
Currently, if "stripInternal": true is set in the compiler options, the @internal JSDoc annotation can be used to prevent it from ending up in the generated type definitions.
When using types in JSDoc, a type can be defined using:
/**
* @typedef {object} MyType
* Description of `MyType`.
*/It would be great of @internal could also be applied to types in JSDoc.
π Motivating Example
The @internal annotation now also works for types defined in JSDoc if the "stripInternal" option is enabled.
/**
* @typedef {object} MyType
* @internal
*/π» Use Cases
These typedefs are always exported, but often they are only defined to import a type. This means that packages often need to add a dependency on packages only for their types, even if the intention isnβt to re-export them.
/**
* @typedef {import('my-package').MyType} MyType
* @internal
*/A lot of practical use cases exist in the unified ecosystem.
For example remark-rehype.