v1.1.0
Minor Changes
-
#6
abc000e
Thanks @lukemorales! - Add support for booleansBoth
exhaustive
andexhaustive.tag
can now be exhaustive checked against booleans:function handleStatus(isSelected: boolean) { return exhaustive(isSelected, { true: () => { // ...run handler for true case }, false: () => { // ...run handler for false case }, }); }
type ProfileStatus = | { checked: true; data: string } | { checked: false; error: string }; function handleProfileStatus(status: ProfileStatus) { return exhaustive.tag(status, "checked", { true: (value) => saveProfile(value.data), // ^? value is { checked: true; data: string } false: (value) => throwException(value.error), // ^? value is { checked: false; error: string } }); }