▲ | WorldMaker 2 days ago | |
Zod is great, but it's a giant monster of Typescript meta-typing on your behalf. Some of it is using that "scary" Turing completeness, even, of Typescript's type system. It is nice in providing extra runtime validation that tests compiler assumptions, but it is adding complexity to do it, not removing it. Also that "Friendly Function" is about returning Sum Type. `ValidationError | int` in the example's case. It isn't saving you from a type system that understands Algebraic Types, it is absolutely relying on it (if you want compile time type safety). Also, it's only about a step or two removed from (re-)discovering the next step which is the Either<Left, Right> monad. You just need a "bind operator" to make those "Friendly Functions" easier to pipeline together and you will be off to the monad races. |