What is the never type in TypeScript?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid TypeScript basics — a prerequisite for any developer role.

Answer

The never type represents values that never occur — it is the type of expressions that never complete normally. Two primary use cases: (1) Functions that never return — either because they always throw an error or run in an infinite loop: function fail(msg: string): never { throw new Error(msg); }. (2) Exhaustiveness checking — in a switch statement over a discriminated union, after handling all cases, the variable in the default case has type never. If a new union member is added without a corresponding case, the type will not be never and TypeScript will report an error — great for enforcing completeness. never is also the result of intersecting incompatible types: string & number is never. Every type is a supertype of never, meaning never can be assigned to any type. never is assignable to all types but nothing is assignable to never (except itself).

Common Mistake

Don't just define the term — demonstrate that you understand when to use it and when not to. Showing awareness of trade-offs is what separates average from strong TypeScript candidates.