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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
=== tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts ===
declare function f1(): string;
>f1 : () => string
declare function f2(): [b: string];
>f2 : () => [b: string]
declare function f3(): { c: string };
>f3 : () => { c: string; }
>c : string
try {
var a = f1();
>a : string
>f1() : string
>f1 : () => string
var [b] = f2();
>b : string
>f2() : [b: string]
>f2 : () => [b: string]
var { c } = f3();
>c : string
>f3() : { c: string; }
>f3 : () => { c: string; }
var [d = 1] = [];
>d : number
>1 : 1
>[] : []
var { e = 1 } = { };
>e : number
>1 : 1
>{ } : { e?: number | undefined; }
} catch {
console.error("error");
>console.error("error") : void
>console.error : (...data: any[]) => void
>console : Console
>error : (...data: any[]) => void
>"error" : "error"
}
a;
>a : string
b;
>b : string
c;
>c : string
d;
>d : number
e;
>e : number
|