Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Using a library like zod requires you to trust that Zod will correctly validate the type.

Not sure I understand this -- are you assuming there’s an existing schema, either a TS type or maybe something else like JSON Schema, and you’re trying to ensure a separate Zod schema parses it correctly?

The usual way to use Zod (or Valibot, etc) is to have the Zod schema be the single source of truth; your TS types are derived from it via z.infer<typeof schema>. That way, there’s no need to take anything on trust, it just works.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: