Skip to content

Commit 3d4c14c

Browse files
committed
Add tests
1 parent b980216 commit 3d4c14c

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator1.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @strict: true
2+
// @allowUnreachableCode: false
23

34
declare const a1: string | undefined | null
45
declare const a2: string | undefined | null
@@ -39,4 +40,28 @@ const cc4 = c4 ?? true;
3940
const dd1 = d1 ?? {b: 1};
4041
const dd2 = d2 ?? {b: 1};
4142
const dd3 = d3 ?? {b: 1};
42-
const dd4 = d4 ?? {b: 1};
43+
const dd4 = d4 ?? {b: 1};
44+
45+
// Repro from #34635
46+
47+
declare function foo(): void;
48+
49+
const maybeBool = false;
50+
51+
if (!(maybeBool ?? true)) {
52+
foo();
53+
}
54+
55+
if (maybeBool ?? true) {
56+
foo();
57+
}
58+
else {
59+
foo();
60+
}
61+
62+
if (false ?? true) {
63+
foo();
64+
}
65+
else {
66+
foo();
67+
}

0 commit comments

Comments
 (0)