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
|
=== tests/cases/compiler/arrayDestructuringInSwitch2.ts ===
type X = { kind: "a", a: [1] } | { kind: "b", a: [] }
>X : Symbol(X, Decl(arrayDestructuringInSwitch2.ts, 0, 0))
>kind : Symbol(kind, Decl(arrayDestructuringInSwitch2.ts, 0, 10))
>a : Symbol(a, Decl(arrayDestructuringInSwitch2.ts, 0, 21))
>kind : Symbol(kind, Decl(arrayDestructuringInSwitch2.ts, 0, 34))
>a : Symbol(a, Decl(arrayDestructuringInSwitch2.ts, 0, 45))
function foo(x: X): 1 {
>foo : Symbol(foo, Decl(arrayDestructuringInSwitch2.ts, 0, 53))
>x : Symbol(x, Decl(arrayDestructuringInSwitch2.ts, 2, 13))
>X : Symbol(X, Decl(arrayDestructuringInSwitch2.ts, 0, 0))
const { kind, a } = x;
>kind : Symbol(kind, Decl(arrayDestructuringInSwitch2.ts, 3, 9))
>a : Symbol(a, Decl(arrayDestructuringInSwitch2.ts, 3, 15))
>x : Symbol(x, Decl(arrayDestructuringInSwitch2.ts, 2, 13))
switch (kind) {
>kind : Symbol(kind, Decl(arrayDestructuringInSwitch2.ts, 3, 9))
case "a":
return a[0];
>a : Symbol(a, Decl(arrayDestructuringInSwitch2.ts, 3, 15))
>0 : Symbol(0)
case "b":
return 1;
default:
const [n] = a;
>n : Symbol(n, Decl(arrayDestructuringInSwitch2.ts, 10, 13))
>a : Symbol(a, Decl(arrayDestructuringInSwitch2.ts, 3, 15))
return a;
>a : Symbol(a, Decl(arrayDestructuringInSwitch2.ts, 3, 15))
}
}
|