I'm aware of io-ts but I haven't jumped on the fp-ts bandwagon yet. The learning curve seems quite steep.
The decoder you just mentioned would fail at compile-time, because number and string are different types.
If the data you want to decode is a number but you want a string you could do:
I'm aware of io-ts but I haven't jumped on the fp-ts bandwagon yet. The learning curve seems quite steep.
The decoder you just mentioned would fail at compile-time, because
number
andstring
are different types.If the data you want to decode is a
number
but you want astring
you could do:Cheers!