-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
Bug Report
π Search Terms
mapping types with docs; preserve docs on mapped types
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about this
β― Playground Link
Playground link with relevant code
π» Code
All relevant code can be found in the example links.
Why doesn't TypeScript/Vscode preserve documentation / JSDoc for mapped types?
Using this example that appears in the TypeScript documentation itself, which you can quickly reproduce in Vscode locally, you can see the problem.
It is expected that when remapping the keys of a type object, the documentation would remain what was defined in the original/previous keys, but this does not happen. Nothing is preserved.
This sucks in the development context, because it requires us to have to repeat the documentation of a property or method, for example, in multiple places, thousands of times. This can lead to consistency issues as the code grows and loses the point of automating things.
Another directly related problem is in Index Signatures. Even if documentation is added, nothing is preserved. This also includes Union Types. An example can be seen here.
π Actual behavior
JSDoc documentation is not preserved in mapped keys.
π Expected behavior
Mapped keys must have JSDoc documentation of their original/previous names.