exhaustiveness checking

Having the compiler prove that code handles every possible member of a union, so a newly added member causes a compile error.

In more detail

The usual technique assigns the value left over in a default branch to never, directly or through assertNever. This turns forgetting a case from a silent run time bug into a build failure that points to the right place.

Related terms

Taught in

References