unsplash / sum-types-io-ts

io-ts bindings for @unsplash/sum-types.
https://unsplash.github.io/sum-types-io-ts/
MIT License
2 stars 1 forks source link

Shorthand nullary codec constructors #3

Closed samhh closed 2 years ago

samhh commented 2 years ago

We don't need values for constructors which are nullary. We do still need the keys in some form however due to the use of Proxy in the main lib. Sum types with all-nullary constructors could benefit from a terser input sans codecs.

What we have now:

getCodecFromSerialized<MySum>({ MemberA: t.undefined, etc })

What we could do:

getCodecFromSerializedNullary<MySum>(['MemberA', etc])