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 62 63 64
|
=== tests/cases/conformance/expressions/assignmentOperator/assignmentTypeNarrowing.ts ===
let x: string | number | boolean | RegExp;
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
x = "";
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
x; // string
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
[x] = [true];
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
x; // boolean
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
[x = ""] = [1];
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
x; // string | number
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
({x} = {x: true});
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 11, 2))
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 11, 8))
x; // boolean
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
({y: x} = {y: 1});
>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 14, 2))
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 14, 11))
x; // number
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
({x = ""} = {x: true});
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 17, 2))
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 17, 13))
x; // string | boolean
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
({y: x = /a/} = {y: 1});
>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 20, 2))
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
>y : Symbol(y, Decl(assignmentTypeNarrowing.ts, 20, 17))
x; // number | RegExp
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
let a: string[];
>a : Symbol(a, Decl(assignmentTypeNarrowing.ts, 23, 3))
for (x of a) {
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
>a : Symbol(a, Decl(assignmentTypeNarrowing.ts, 23, 3))
x; // string
>x : Symbol(x, Decl(assignmentTypeNarrowing.ts, 0, 3))
}
|