mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
da487ee641
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: RyanCavanaugh <[email protected]>
20 lines
687 B
TypeScript
20 lines
687 B
TypeScript
//// [tests/cases/compiler/nullishCoalescingAlwaysNullFalsePositive.ts] ////
|
|
|
|
//// [nullishCoalescingAlwaysNullFalsePositive.ts]
|
|
// 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;
|
|
|
|
|
|
//// [nullishCoalescingAlwaysNullFalsePositive.js]
|
|
"use strict";
|
|
// Repro for https://github.com/microsoft/TypeScript/issues/63642
|
|
// TS2871 false positive: conditional with ?? null in true branch
|
|
const p = (a ? b ?? null : null) ?? 0;
|
|
const q = (x ??= null) ?? 0;
|