Repository: TypeScript
Issue: Preserve comments with object destructuring assignment
Labels: Suggestion,Awaiting More Feedback

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the "Common Feature Requests" section.

-->

## Search Terms

<!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily -->
object destructuring assignment, comment

## Suggestion

<!-- A summary of what you'd like to see added or changed -->

```ts
interface MyInterface {
    /**
     * I am x
     */
    x : number;
    /**
     * I am y
     */
    y : number;
}
declare const myInterface : MyInterface;
const {x, y} = myInterface;

/**
 * Expected tooltip to have comment,
 * > I am x
 * 
 * Actual: No comment
 */
x;
/**
 * Expected tooltip to have comment,
 * > I am y
 * 
 * Actual: No comment
 */
y;

/**
 * Expected tooltip to have comment,
 * > I am x
 * 
 * Actual:
 * Tooltip has comment,
 * > I am x
 */
myInterface.x;

/**
 * Expected tooltip to have comment,
 * > I am y
 * 
 * Actual:
 * Tooltip has comment,
 * > I am y
 */
myInterface.y;

/**
 * I am z
 */
const z = 1;

/**
 * Expected tooltip to have comment,
 * > I am z
 * 
 * Actual:
 * Tooltip has comment,
 * > I am z
 */
z;
```

[Playground](http://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgLIE8CS5rycgbwFgAoZc5AegCprSLzrlNk4BbZAD3oesp-KdkALmQgArmwBG0ANwCqtBciYt2ydMr4L0IsZJlR5JAL6kAJhAQAbOFBQIA9iADOYZGyw5YiFKIzYkD5Ixk6u7gScADQaJsgAvB5eQXgQxqQ0dGRMAKKcAA5WkObIYI6O1mDA+aWOyAAWcABuDo5sbBDgUfRMAHzMrBzc2cg9yACCCGDicNaiAHJ1Tu2dYD38JJzGmWN5hVMQJWUVVTVlDc2tK11j-WocmiNjk9OzC0ttHeDrpOjpJDsRnsiodaidqrULi1kMsvmBuiM7oMuGNnlMZnMxgAVcqVCGNFwwz6rBEqZBI9TDFQbTyBXC+AB0W1IGSUQIKIKOuNOkMa0NhJNuA3UjzJaNemJGOPBNQJROu8KF9w0PxItO8qQZfxZALZZOVAC9VWE3MgDQlkABGf6AsnAg5cmW8y7yuGkvrCjhGp4jF4Y4TY7n4uCEgU3RGes2qg2yIA)

## Use Cases

<!--
What do you want to use this for?
What shortcomings exist with current approaches?
-->

I came across this idea after writing code like this,

```ts
function foo (
  {
    somePropertyA,
    somePropertyB,
    somePropertyC,
  } : SomeObject
) {
  /* Use these properties */
}
```

And I was hazy on the details of what each property was for.
So, I hovered my cursor over the variables `somePropertyA, somePropertyB, somePropertyC` and noticed there were no comments.

I had to go to the declaration of `somePropertyA, somePropertyB, somePropertyC` and look at each property individually.

-----

At the moment, the way to get comments is to just do,

```ts
function foo (
  o : SomeObject
) {
  /* Use these properties */
}
```

Then the tooltip for `o.somePropertyA, o.somePropertyB, o.somePropertyC` will have comments

## Examples

<!-- Show how this would be used and what the behavior would be -->

See above suggestion

## Checklist

My suggestion meets these guidelines:

* [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [X] This wouldn't change the runtime behavior of existing JavaScript code
* [X] This could be implemented without emitting different JS based on the types of the expressions
* [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
* [X] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).