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

getCodecFromMappedNullaryTag#is handles unsafe inputs #15

Closed Magellol closed 1 year ago

Magellol commented 1 year ago

Here's my proposed solution to fix the bug highlighted by the test here: https://github.com/unsplash/sum-types-io-ts/pull/15/commits/cc300f3b88c65b005a0109b09ca4b12500c70ec5

Alternatively, we could have a predicate available in sum-types to be able to deal with unknown inputs and we could leverage that here.

Unsplash internal ref: https://crewlabs.slack.com/archives/C0STWEZ2B/p1684158203122269

Magellol commented 1 year ago

@samhh Agreed. I've added a few more unsafe inputs 97ce994 for the time being. Open to provide another PR if/when sum-types gets an API we can leverage.