TypeScript/tests/baselines/reference/declarationEmitDestructuring4.js

39 lines
1 KiB
TypeScript
Raw Normal View History

2015-03-24 01:58:53 +01:00
//// [declarationEmitDestructuring4.ts]
2015-03-24 18:11:29 +01:00
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
2015-03-24 01:58:53 +01:00
function baz([]) { }
function baz1([] = [1,2,3]) { }
function baz2([[]] = [[1,2,3]]) { }
2015-03-24 18:11:29 +01:00
2015-03-24 01:58:53 +01:00
function baz3({}) { }
function baz4({} = { x: 10 }) { }
//// [declarationEmitDestructuring4.js]
2015-03-24 18:11:29 +01:00
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
2015-06-23 01:45:12 +02:00
function baz(_a) { }
2015-06-24 00:05:56 +02:00
function baz1(_a) {
var _a = [1, 2, 3];
}
2015-03-24 01:58:53 +01:00
function baz2(_a) {
var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0];
2015-03-24 01:58:53 +01:00
}
2015-06-23 01:45:12 +02:00
function baz3(_a) { }
2015-06-24 00:05:56 +02:00
function baz4(_a) {
var _a = { x: 10 };
}
2015-03-24 01:58:53 +01:00
//// [declarationEmitDestructuring4.d.ts]
declare function baz([]: any[]): void;
declare function baz1([]?: number[]): void;
declare function baz2([[]]?: [number[]]): void;
declare function baz3({}: {}): void;
declare function baz4({}?: {
x: number;
}): void;