Microsoft/TypeScript — pull request #1346 by ahejlsberg (2014-12-03 01:11:37+00:00)
Title: Destructuring

This pull request adds support for ECMAScript 6 destructuring declarations and assignments with down-level ES3 and ES5 code generation. For example:
```typescript
var [x, y] = [10, 20];
[x, y] = [y, x];
```
The above example generates:
```javascript
var _a = [10, 20], x = _a[0], y = _a[1];
_b = [y, x], x = _b[0], y = _b[1];
```
Another example:
```typescript
interface NameAndLocation {
name: string;
location: [number, number];
}

function getNameAndLocation(): NameAndLocation {
return { name: "top-left", location: [10, 20] };
}

function displayNameAndLocation({name, location: [x, y] = [0, 0]}: NameAndLocation) {
console.log("name=" + name + " x=" + x + " y=" + y);
}

var {name, location: [x, y]} = getNameAndLocation();
displayNameAndLocation(getNameAndLocation());
```
The above example generates:
```javascript
function getNameAndLocation() {
return { name: "top-left", location: [10, 20] };
}
function displayNameAndLocation(_a) {
var name = _a.name, _b = _a.location, _c = _b === void 0 ? [0, 0] : _b, x = _c[0], y = _c[1];
console.log("name=" + name + " x=" + x + " y=" + y);
}
var _a = getNameAndLocation(), name = _a.name, _b = _a.location, x = _b[0], y = _b[1];
displayNameAndLocation(getNameAndLocation());
```
Work still remaining:
* Support for rest elements in array destructuring.
* Pure ES6 code generation with no rewriting (under -target ES6 switch).
* Updated spec.