diff --git a/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator1.ts b/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator1.ts index 80f0c64e7d9..f7024fd8292 100644 --- a/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator1.ts +++ b/tests/cases/conformance/expressions/nullishCoalescingOperator/nullishCoalescingOperator1.ts @@ -1,4 +1,5 @@ // @strict: true +// @allowUnreachableCode: false declare const a1: string | undefined | null declare const a2: string | undefined | null @@ -39,4 +40,28 @@ const cc4 = c4 ?? true; const dd1 = d1 ?? {b: 1}; const dd2 = d2 ?? {b: 1}; const dd3 = d3 ?? {b: 1}; -const dd4 = d4 ?? {b: 1}; \ No newline at end of file +const dd4 = d4 ?? {b: 1}; + +// Repro from #34635 + +declare function foo(): void; + +const maybeBool = false; + +if (!(maybeBool ?? true)) { + foo(); +} + +if (maybeBool ?? true) { + foo(); +} +else { + foo(); +} + +if (false ?? true) { + foo(); +} +else { + foo(); +}