| ▲ | _the_inflator a day ago | |||||||
Serious question: how widespread and actually used in production is Zod? Honestly, it made things worse for me. JavaScript isn’t a statistical typed language and TypeScript already is something, where due to compiler issues I just use “any”. Zod has its conventions and JavaScript ain’t Java. So Zod is also hard to read and debug. It is type conversion to type conversion - bloat, not JavaScript. Even Pydantic looks tamed compared to Zod. So how do you use it? Which conventions? Only for validation at certain steps? APIs? I stopped using TanStack because it got to meta for me and AI as well. Tests are needed anyway, I rely on TypeScript only now. | ||||||||
| ▲ | jackp96 a day ago | parent | next [-] | |||||||
I mostly use it for runtime validation for API responses. Found it pretty easy to use. I try pretty hard to avoid "any" in the code, and it's helped clean things up a good bit, which is crucial as we've introduced LLMs into our workflows. I don't love Pydantic, though. It's probably a skill issue, but it just feels messier/clunkier than Zod's parsing options. | ||||||||
| ||||||||
| ▲ | Escapado a day ago | parent | prev | next [-] | |||||||
I use it heavily for form validation on the client and the server and it plays very well drizzle in my opinion. In the past I also used it a bunch for validating responses from a product API as it was not always guaranteed that the data had the agreed shape and we could hence account for that during runtime and surface problems in a simple way. | ||||||||
| ▲ | skybrian a day ago | parent | prev | next [-] | |||||||
I use Valibot instead, but it’s for similar reasons. The most common usages are validating JSON requests and reading JSON files. | ||||||||
| ▲ | satvikpendem a day ago | parent | prev | next [-] | |||||||
> TypeScript already is something, where due to compiler issues I just use “any”. Uh, maybe you're not seeing the benefit due to this. My codebase bans "any" and Zod is great for runtime data validation. | ||||||||
| ▲ | mpalmer a day ago | parent | prev [-] | |||||||
Why use TypeScript at all?
Rebuttal: no it is not. Poorly written code is hard to read and debug; TypeScript in particular is hard to read and debug when you explicitly type things as `any`. | ||||||||