3 ms·
I don't like writing type definitions with zod's DSL. I want to write definitions in the "first party syntax" - which both JSDoc and Typescript types are - and
by madeofpalk 3y ago
I don't like writing type definitions with zod's DSL.
I want to write definitions in the "first party syntax" - which both JSDoc and Typescript types are - and have everything else generated out from that.
- purplerabbit 3y agoI like the sentiment, but you’ve gotta admit that being able to skip the “generation” step has its benefits
- madeofpalk 3y agoThe only way to can skip that generation is if the zod type is your primary schema, which is only possible if your API is in javascript.
- yencabulator 3y agoEverybody seems to want that, except for the people who work on Typescript, who argue it'd be the wrong tool. Typescript's types simply aren't able to provide input validation, both because they don't exist at runtime and for lack of power ("number must be 0..10"). At least with Zod, you also get Typescript types, from the same schema.
- deleted 3y ago[deleted]