/exhaustive-helper

Make tolerable a poor man's version of exhaustive pattern-matching, in TypeScript

Primary LanguageTypeScript

exhaustive is a function to help statically check that you explicitly handle all possible values.

See its documentation for a longer explanation. TypeScript's never type is the novel thing that makes it work.

We could copy & paste the function definition into a "utils" file in each project, but why not define it centrally and reuse it? That's why it's been put on this module registry:

import exhaustive from "jsr:@duncan/exhaustive"