Repository: TypeScript
Issue: Mapped keys do not preserve JSDoc documentation
Labels: Suggestion,Help Wanted,Experience Enhancement

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->
mapping types with docs; preserve docs on mapped types

### 🕗 Version & Regression Information

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about this

### ⏯ Playground Link

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant code](https://www.typescriptlang.org/play?#code/C4TwDgpgBA4hzAgJwM4B4Aq4ID4oF4oBvAKCigG0AFJAe0iVCgEsA7KAawhFoDMoskKAEMUUAAYBzeABIiAYWFhmwYQBtmALwhoUwJG0lQAZFBr1koHAF9xAXQBcUABQBKAnkERqdBqDsk1gDcJCRsiEi8wgDG0FTIKLTspOQA9KlQgKDkUADqABYQ7Hm0AG7IhlAFSBAANFDABVAAJrTRAK4AtoWqwMxJLGJNzChgasIgEE11oizAUCjFbWpNAHRkUKkAVJvrUJtmCUkA5GKswl1r5HtQAAIQAB7no9AARABStHnsACK0EC+7TapdZnLpOPQGViSELrdJZXIFIqlcpQyrIWr1RotdpdVg9PrsYbNYajcaTaZiFTzRbLS4bbaAg6oY5iACC0jp1zujw6zygAGYAAyA4HkYTSJysToAI2QMLSGWy+UKlWRkKMVQxDWg2M63WEvX6RKGIzGEymIkpcwWtCWq1hDKu+3izNYJygABlWgaCZz9tynmpXgAhJDCTTMNQAp2iqBqb2G1jg-SGELWUKgIQe8MgF2JdiEOAIBJoPNJHAw6JJPRQMHZzS5w4F4iwjKAGXIESrimV1WjqnVtc1Wnq8T6jWIAHIAeQwxNNZPt5GkwAn5wgTjcHig72EXCgikYyBeNVbUA7yqRPYqmoHWOHuPx46g09nJtJ5rpy-Z65c7nweH5ABWE8FTPTtLxRDV0VvHV731RMBmfGc53fSZP3gL1ojHJNfy3F4AFVWBUSYoAAZR6CAUABYJQlA89EVVK9URvTFYJxeCCUQl8ULNNCSAuZdVy6NxQhIIA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
All relevant code can be found in the example links.

Why doesn't TypeScript/Vscode preserve documentation / JSDoc for mapped types?

Using [this example](https://www.typescriptlang.org/play?#code/C4TwDgpgBA4hzAgJwM4B4Aq4ID4oF4oBvAKCigG0AFJAe0iVCgEsA7KAawhFoDMoskKAEMUUAAYBzeABIiAYWFhmwYQBtmALwhoUwJG0lQAZFBr1koHAF9xAXQBcUABQBKAnkERqdBqDsk1gDcJCRsiEi8wgDG0FTIKLTspOQA9KlQgKDkUADqABYQ7Hm0AG7IhlAFSBAANFDABVAAJrTRAK4AtoWqwMxJLGJNzChgasIgEE11oizAUCjFbWpNAHRkUKkAVJvrUJtmCUkA5GKswl1r5HtQAAIQAB7no9AARABStHnsACK0EC+7TapdZnLpOPQGViSELrdJZXIFIqlcpQyrIWr1RotdpdVg9PrsYbNYajcaTaZiFTzRbLS4bbaAg6oY5iACC0jp1zujw6zygAGYAAyA4HkYTSJysToAI2QMLSGWy+UKlWRkKMVQxDWg2M63WEvX6RKGIzGEymIkpcwWtCWq1hDKu+3izNYJygABlWgaCZz9tynmpXgAhJDCTTMNQAp2iqBqb2G1jg-SGELWUKgIQe8MgF2JdiEOAIBJoPNJHAw6JJPRQMHZzS5w4F4iwjKAGXIESrimV1WjqnVtc1Wnq8T6jWIAHIAeQwxNNZPt5GkwAn5wgTjcHig72EXCgikYyBeNVbUA7yqRPYqmoHWOHuPx46g09nJtJ5rpy-Z65c7nweH5ABWE8FTPTtLxRDV0VvHV731RMBmfGc53fSZP3gL1ojHJNfy3F4AFVWBUSYoAAZR6CAUABYJQlA89EVVK9URvTFYJxeCCUQl8ULNNCSAuZdVy6NxQhIIA) 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](https://www.typescriptlang.org/play?#code/C4TwDgpgBAzg9gWwgFXNAvFA3gKClAegCoi98jZFpgIAPYKYOKAI2gBMBLGMAGwEMQEdmShECZANoBrCCABcMYACdOAOwDmAXXmwV6jQG4cAX2M4AxnDVLGEJYqqpIUTLnwECUQDLkUAOoAFhBqUAFwAG4QqpqhURAANIxBUOxwFgCuSGrA-MCc1lDcUAByAPLIKdx8gsIAdGT8aiDAAQa6AESNIO2m5qAu6Wr5as4YUO00Su1QAD7jk8AATO19aFCDwwCitPwIfGPuhCSiFPBIdvSMzGyVPAJCIvhiEvgycoUhG9ajOkrRRr0cJZrLY4C0ovIvmptrt9q5sGRPD5-EEQmFIv9YsoEkkOGlMsEcnkCkUyhUuHcaux6vgFh0uu14oivL5AsFQhEogYsTjwSl8VkicNCjASuVbtUHjS7EpFvSmstATggA).


### 🙁 Actual behavior
JSDoc documentation is not preserved in mapped keys.
<!-- What happened, and why it was wrong -->

### 🙂 Expected behavior
Mapped keys must have JSDoc documentation of their original/previous names.
<!-- What you expected to happen instead, and why -->