frou / exhaustive-helper

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 this work.


We could copy+paste this function into a "utils" junk-drawer in each project, but why not define it centrally and reuse it?

As such, it is available from the Deno third-party module registry:

import exhaustive from "https://deno.land/x/exhaustive/mod.ts"

About

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


Languages

Language:TypeScript 100.0%