Let's say I have the following io-ts runtimetype:
const Example = t.keyof({
'foo': null,
'bar': null
})
type ExampleType = typeof Example
And I have an incoming request with value: string
How can I convert value to an Example
(or fail and throw an exception?)
Functional programming isn't my strong suit, but this should get you going.