Never Type
Never
let foo: never; // Okaylet foo: never = 123; // Error: Type number is not assignable to never
// Okay as the function's return type is `never`
let bar: never = (() => { throw new Error(`Throw my hands in the air like I just don't care`) })();Use case: Exhaustive Checks
Confusion with void
voidType inference in never returning functions
Last updated