never (type)

The TypeScript type with no values, used for code that can never be reached or functions that never return.

In more detail

A function that always throws returns never. After a switch has handled every member of a union, the remaining value is never, which is how exhaustiveness checks work. Intersecting incompatible types, and remapping a key to never in a mapped type, also produce it.

Related terms

Taught in

References