TypeScript · Senior · Question 5 of 75
Why does type IsNever<T> = T extends never ? true : false give never for IsNever<never>?
- ✓Correct answer:
neveris an empty union, and distributing over it yields an empty result - 2It's a compiler bug, so
nevercan't be checked at all - 3
neveris always assignable to the literalfalsein conditional types
Explanation
A distributive conditional type applies to each union member, and never has no members - the result is never. The correct check is [T] extends [never] ? true : false.