4 ms·
Personally, I find Zod’s API extremely intimidating. Anything more resembling TypeScript is way better. ArkType is neat, but ideally we’d have something like:
by notpushkin 2y ago
Personally, I find Zod’s API extremely intimidating. Anything more resembling TypeScript is way better. ArkType is neat, but ideally we’d have something like:
export reflect type User = {
id: number;
username: string;
// ...
};
Edit: just remembered about this one: https://github.com/GoogleFeud/ts-runtime-checks https://github.com/GoogleFeud/ts-runtime-checks
- ChocolateGod 2y agoIt's not perfect and doesn't cover all of zods functionality (iirc coercion) but I've used https://www.npmjs.com/package/ts-to-zod https://www.npmjs.com/package/ts-to-zod before to generate zod schemas directly from types.
- crabmusket 2y agoThis is why I like libraries like typia or typebox-codegen; I'd prefer to write TypeScript and generate the validation, rather than write a DSL.