File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/cases/conformance/expressions/typeGuards Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments