TypeScript · Types that pay for themselves

What is the never type used for?

Mediumneverexhaustivenesscontrol-flowUpdated Oct 2026
Quiz this track

Short answer

never is the type of values that cannot exist. It appears in exhaustive checks, impossible branches and functions that always throw, and it is absorbed by unions.

never is the bottom type. No value is assignable to never except another never, and never is assignable to every type. The compiler uses it to represent code paths that cannot be reached or functions that never return normally.

ts
function fail(message: string): never {
  throw new Error(message);
}

type Result = string | never;

function assertNever(value: never): never {
  throw new Error("Unexpected value: " + String(value));
}

Where never appears

  • Functions that always throw or loop forever
  • Exhaustive switch defaults after every union member is handled
  • Conditional types that filter out non-matching members
  • Intersections with incompatible properties
  • Unreachable branches after narrowing

In a union, never disappears because it contributes no values. That property is what makes exhaustive checks work: after every real member is handled, the remaining value is never, so passing it to a function that accepts never compiles only if the switch is complete.

never is not the same as void. void means a function returns without a useful value; never means the function does not return at all.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What is the difference between never and void?
  2. 2How does never enable exhaustiveness checking?
  3. 3Why does never disappear from a union?
  4. 4When does a function have a never return type?

Say it in the interview

never represents a value that cannot exist. I use it for functions that always throw and for exhaustive checks where the remaining value should be impossible. In a union, never disappears, which makes it useful for filtering. I keep it distinct from void, which means a function returns without a useful value.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live TypeScript mock interview and get scored feedback on depth, clarity and confidence.