TypeScript · Types and shapes

never

The type of a value that cannot happen, or of a function that never returns normally.

Syntax
never

Example

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

More in this group

any Array types enums Function type Interface Literal type null and undefined Optional property

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course