TypeScript/tests/cases/conformance/types/rest/objectRestForOf.ts
Nathan Shively-Sanders ac20b46f4f Add rest tests
2016-11-02 14:56:58 -07:00

14 lines
358 B
TypeScript

// @target: es2015
let array: { x: number, y: string }[];
for (let { x, ...restOf } of array) {
[x, restOf];
}
let xx: number;
let rrestOff: { y: string };
for ({ x: xx, ...rrestOff } of array ) {
[xx, rrestOff];
}
for (const norest of array.map(a => ({ ...a, x: 'a string' }))) {
[norest.x, norest.y];
// x is now a string. who knows why.
}