TypeScript · Types and shapes
never
The type of a value that cannot happen, or of a function that never returns normally.
Syntax
neverExample
Example
function fail(message: string): never {
throw new Error(message);
}More in this group
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.