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

Support untagged non-nullary sums #20

Closed samhh closed 1 year ago

samhh commented 1 year ago

Borrowing terminology from Serde: https://serde.rs/enum-representations.html#untagged

For any given data:

Sum.Member<'Sun'> | Sum.Member<'Rain', { mm: number }>

<->

{} | { mm: number }

A challenge here is in how, as in this example, the outcome is affected by in which order the members attempt deserialisation.