Skip to content

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

Notifications You must be signed in to change notification settings

frou/exhaustive-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

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"