Skip to content

Commit 635a24b

Browse files
committed
Add tests
1 parent 087dcb2 commit 635a24b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// @strict: true
2+
3+
// Literal enum type
4+
enum E1 {
5+
a = 1,
6+
b = 2,
7+
}
8+
9+
// Numeric enum type
10+
enum E2 {
11+
a = 1 << 0,
12+
b = 1 << 1
13+
}
14+
15+
function f1(v: E1) {
16+
if (v !== 0) { // Error
17+
v;
18+
}
19+
if (v !== 1) {
20+
v;
21+
}
22+
if (v !== 2) {
23+
v;
24+
}
25+
if (v !== 3) { // Error
26+
v;
27+
}
28+
}
29+
30+
function f2(v: E2) {
31+
if (v !== 0) {
32+
v;
33+
}
34+
if (v !== 1) {
35+
v;
36+
}
37+
if (v !== 2) {
38+
v;
39+
}
40+
if (v !== 3) {
41+
v;
42+
}
43+
}

0 commit comments

Comments
 (0)