Skip to content

Glossary: TypeScript Beyond the Basics

assertNever

A function that takes a `never` value and throws. Calling it in a `switch` default makes the compiler complain if you forget to handle a member of a union.

Where the book teaches it

Related terms

neverAssertion function