Get in touch

Send an email to:
Or find me online at: Github, X

The never type

The never type in TypeScript can be used to represent the type of a value that never occurs.

This function will never return anything:

function alwaysThrow(message: string): never {
  throw new Error(message);

Neither will this function:

function neverStop(): never {
  while(true) {
    // Do something