Hacker News new | ask | show | jobs
by shepherdjerred 670 days ago
IMO Zod is much easier to understand than io-ts, the counterpart to fp-ts: https://zod.dev/
1 comments

It’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.

Zod 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.