Files
tsgo/testdata/tests/cases/compiler/nullishCoalescingAlwaysNullFalsePositive.ts
da487ee641 Fix TS2871 false positive for ?? operator in nullish coalescing check (#4586)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: RyanCavanaugh <[email protected]>
2026-07-17 16:06:42 +00:00

11 lines
298 B
TypeScript

// @strict: true
// Repro for https://github.com/microsoft/TypeScript/issues/63642
// TS2871 false positive: conditional with ?? null in true branch
declare let a: unknown, b: unknown;
const p = (a ? b ?? null : null) ?? 0;
declare let x: string | null | undefined;
const q = (x ??= null) ?? 0;