Skip to content

Commit 581f52a

Browse files
committed
exhaustive tests
1 parent 346253a commit 581f52a

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

tests/cases/conformance/expressions/typeGuards/typeGuardTypeOfUndefined.ts

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ function test1(a: any) {
44
if (typeof a === "boolean") {
55
a;
66
}
7+
else {
8+
a;
9+
}
10+
}
11+
else {
12+
a;
713
}
814
}
915

@@ -12,17 +18,167 @@ function test2(a: any) {
1218
if (typeof a === "boolean") {
1319
a;
1420
}
21+
else {
22+
a;
23+
}
24+
}
25+
else {
26+
a;
1527
}
1628
}
1729

1830
function test3(a: any) {
1931
if (typeof a === "undefined" || typeof a === "boolean") {
2032
a;
2133
}
34+
else {
35+
a;
36+
}
2237
}
2338

2439
function test4(a: any) {
2540
if (typeof a !== "undefined" && typeof a === "boolean") {
2641
a;
2742
}
43+
else {
44+
a;
45+
}
46+
}
47+
48+
function test5(a: boolean | void) {
49+
if (typeof a !== "undefined") {
50+
if (typeof a === "boolean") {
51+
a;
52+
}
53+
else {
54+
a;
55+
}
56+
}
57+
else {
58+
a;
59+
}
60+
}
61+
62+
function test6(a: boolean | void) {
63+
if (typeof a === "undefined") {
64+
if (typeof a === "boolean") {
65+
a;
66+
}
67+
else {
68+
a;
69+
}
70+
}
71+
else {
72+
a;
73+
}
74+
}
75+
76+
function test7(a: boolean | void) {
77+
if (typeof a === "undefined" || typeof a === "boolean") {
78+
a;
79+
}
80+
else {
81+
a;
82+
}
83+
}
84+
85+
function test8(a: boolean | void) {
86+
if (typeof a !== "undefined" && typeof a === "boolean") {
87+
a;
88+
}
89+
else {
90+
a;
91+
}
92+
}
93+
94+
function test9(a: boolean | number) {
95+
if (typeof a !== "undefined") {
96+
if (typeof a === "boolean") {
97+
a;
98+
}
99+
else {
100+
a;
101+
}
102+
}
103+
else {
104+
a;
105+
}
106+
}
107+
108+
function test10(a: boolean | number) {
109+
if (typeof a === "undefined") {
110+
if (typeof a === "boolean") {
111+
a;
112+
}
113+
else {
114+
a;
115+
}
116+
}
117+
else {
118+
a;
119+
}
120+
}
121+
122+
function test11(a: boolean | number) {
123+
if (typeof a === "undefined" || typeof a === "boolean") {
124+
a;
125+
}
126+
else {
127+
a;
128+
}
129+
}
130+
131+
function test12(a: boolean | number) {
132+
if (typeof a !== "undefined" && typeof a === "boolean") {
133+
a;
134+
}
135+
else {
136+
a;
137+
}
138+
}
139+
140+
function test13(a: boolean | number | void) {
141+
if (typeof a !== "undefined") {
142+
if (typeof a === "boolean") {
143+
a;
144+
}
145+
else {
146+
a;
147+
}
148+
}
149+
else {
150+
a;
151+
}
152+
}
153+
154+
function test14(a: boolean | number | void) {
155+
if (typeof a === "undefined") {
156+
if (typeof a === "boolean") {
157+
a;
158+
}
159+
else {
160+
a;
161+
}
162+
}
163+
else {
164+
a;
165+
}
166+
}
167+
168+
function test15(a: boolean | number | void) {
169+
if (typeof a === "undefined" || typeof a === "boolean") {
170+
a;
171+
}
172+
else {
173+
a;
174+
}
175+
}
176+
177+
function test16(a: boolean | number | void) {
178+
if (typeof a !== "undefined" && typeof a === "boolean") {
179+
a;
180+
}
181+
else {
182+
a;
183+
}
28184
}

0 commit comments

Comments
 (0)