Fixed distributive conditional types with never intersections (#57345)

This commit is contained in:
Mateusz Burzyński
2024-02-09 21:25:02 +01:00
committed by GitHub
parent c5db0ac0ef
commit e2bf8b437d
4 changed files with 70 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
// @strict: true
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/57343
type IsNumber<T> = T extends number ? true : false;
type Conflicted = { x: true } & { x: false };
type Ex1 = IsNumber<Conflicted>; // never
type Ex2 = IsNumber<"OEEE" | Conflicted>; // false
type Ex3 = IsNumber<1 | Conflicted>; // true