Skip to content

Commit 346253a

Browse files
committed
test, first pass at a fix
1 parent 7743d20 commit 346253a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ namespace ts {
200200
"symbol": {
201201
type: esSymbolType,
202202
flags: TypeFlags.ESSymbol
203+
},
204+
"undefined": {
205+
type: undefinedType,
206+
flags: TypeFlags.ContainsUndefinedOrNull
203207
}
204208
};
205209

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// undefined type guard adds no new type information
2+
function test1(a: any) {
3+
if (typeof a !== "undefined") {
4+
if (typeof a === "boolean") {
5+
a;
6+
}
7+
}
8+
}
9+
10+
function test2(a: any) {
11+
if (typeof a === "undefined") {
12+
if (typeof a === "boolean") {
13+
a;
14+
}
15+
}
16+
}
17+
18+
function test3(a: any) {
19+
if (typeof a === "undefined" || typeof a === "boolean") {
20+
a;
21+
}
22+
}
23+
24+
function test4(a: any) {
25+
if (typeof a !== "undefined" && typeof a === "boolean") {
26+
a;
27+
}
28+
}

0 commit comments

Comments
 (0)