File: declarationEmitDestructuring1.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (37 lines) | stat: -rw-r--r-- 1,110 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//// [declarationEmitDestructuring1.ts]
function foo([a, b, c]: [string, string, string]): void { }
function far([a, [b], [[c]]]: [number, boolean[], string[][]]): void { }
function bar({a1, b1, c1}: { a1: number, b1: boolean, c1: string }): void { }
function baz({a2, b2: {b1, c1}}: { a2: number, b2: { b1: boolean, c1: string } }): void { } 


//// [declarationEmitDestructuring1.js]
function foo(_a) {
    var a = _a[0], b = _a[1], c = _a[2];
}
function far(_a) {
    var a = _a[0], b = _a[1][0], c = _a[2][0][0];
}
function bar(_a) {
    var a1 = _a.a1, b1 = _a.b1, c1 = _a.c1;
}
function baz(_a) {
    var a2 = _a.a2, _b = _a.b2, b1 = _b.b1, c1 = _b.c1;
}


//// [declarationEmitDestructuring1.d.ts]
declare function foo([a, b, c]: [string, string, string]): void;
declare function far([a, [b], [[c]]]: [number, boolean[], string[][]]): void;
declare function bar({ a1, b1, c1 }: {
    a1: number;
    b1: boolean;
    c1: string;
}): void;
declare function baz({ a2, b2: { b1, c1 } }: {
    a2: number;
    b2: {
        b1: boolean;
        c1: string;
    };
}): void;