Hacker News new | ask | show | jobs
by notpushkin 427 days 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
2 comments

This 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.
It'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 before to generate zod schemas directly from types.