top | item 41794441

(no title)

aleclarsoniv | 1 year ago

I'd recommend TypeBox[1] as an alternative, which has a runtime “compiler” for generating optimized JS functions from the type objects. It also produces a JSON schema, which can be useful for generating API docs and API clients if needed.

It also has a companion library[2] for generating TypeBox validators from TypeScript definitions, which I'm currently using in an RPC library I'm working on.

[1]: https://github.com/sinclairzx81/typebox [2]: https://github.com/sinclairzx81/typebox-codegen

discuss

order

JasonSage|1 year ago

We are moving from Zod to TypeBox because there’s a lot of inflexibility in Zod’s extensibility story that we’re able to get past in TypeBox.

After doing a deep-dive comparison, I’m left wondering why to ever choose Zod over TypeBox.

wruza|1 year ago

[2]

Man why doesn’t it have a cli tool?? Wouldn’t it be nice to :'<'>!typeboxify a selection.