Pattern Matching
Exports
exhaustive
import { exhaustive } from 'funkcia/pattern-matching';
type State = 'IDLE' | 'LOADING' | 'SUCCESS' | 'ERROR';
function message(state: State) {
return exhaustive(state, {
IDLE: () => 'Idle',
LOADING: () => 'Loading',
SUCCESS: () => 'Success',
ERROR: () => 'Error',
});
}Tagged unions with _tag
_tagFallback case
exhaustive.tag
corrupt
Last updated
Was this helpful?