A conditional type meant to detect the never type behaves unexpectedly due to distribution.
Codetypescript
type IsNever<T> = T extends never ? true : false;
type A = IsNever<string>; // false ✅
type B = IsNever<number>; // false ✅
type C = IsNever<never>; // expected: true
// Using it to guard a helper:
type AssertNever<T> = IsNever<T> extends true
? "empty"
: "has value";
type Result = AssertNever<never>; // expected "empty"
What is the bug that makes IsNever<never> not resolve to true?