ts-enum-mapper
ts-enum-mapper
makes it easy to have one-to-one relationships between an enum and a set of values.
I.e. instead of an exhaustive switch
with a case-per-value and an assertNever
, you can do one-line-per-value and still get the benefits of type-checking (because the compiler will enforce that your mapping definition has a key for each enum value):
; expectmapping.mapColor.Red.toEqual'red!';expectmapping.parse'red!'.toEqualColor.Red;
Instead of the more traditional: