4 ms·
IMO Zod is much easier to understand than io-ts, the counterpart to fp-ts: https://zod.dev/ https://zod.dev/
by shepherdjerred 2y ago
IMO Zod is much easier to understand than io-ts, the counterpart to fp-ts: https://zod.dev/ https://zod.dev/
- eyelidlessness 2y agoIt’s been a while since I looked deeply at them, but IIRC the primary difference is that io-ts returns Result types. It’s trivial to wrap that to produce a value or throw if that feels more comfortable. It’s possible there are other aspects of the APIs that differ in meaningful ways, but last I checked virtually all of the libraries with similar functionality (and there are many) have roughly the same concepts until your schemas themselves get deeply complex.
- zarzavat 2y agoZod can also return result types: T.safeParse(x) It’s not a very full featured Result, but you can wrap it with your own type.