Proposal for Adding `decodePrimitives` Function for Enhanced Type Mapping
Would it make sense to add another
It would be similar to
When decoding data from 3rd party sources I mostly need to use
Having another function that expects primitives would also improve DX to leverage IDE autocompletion with schema props.
What I ended up doing is creating a type called
Which for instance generate something similar to :
instead of
And the I use it like this:
What's your opinion ?
decode function looking smthing like decodePrimitives .It would be similar to
decodeUnknown with the only difference lying in the input types not being unknown but being the primitives type of the expected output object.When decoding data from 3rd party sources I mostly need to use
decodeUnknown. However sometimes it's just a matter of mapping data shapes, or mapping an external string that is expected to be a union, a literal, enum or whatever. So I am confident enough to not pass an unknown value to the decodeUnknown, yet not confident enough to use the base decode.Having another function that expects primitives would also improve DX to leverage IDE autocompletion with schema props.
What I ended up doing is creating a type called
Primitives that I use like this:Which for instance generate something similar to :
instead of
And the I use it like this:
What's your opinion ?
