What is Standard Schema?
Standard Schema v1 is a shared protocol that validation libraries implement so that frameworks can accept any compliant schema without coupling to a specific library. When a framework supports Standard Schema, it reads a~standard property on your schema object to validate inputs in a uniform way.
ts-chas implements this protocol automatically. Every guard chain you build with is.* and every schema you define with defineSchemas exposes the ~standard property — you don’t need to adapt or wrap anything.
The
~standard property is attached automatically to every guard chain produced by is.* and to every schema returned by defineSchemas. You never need to configure it manually.Integration with tRPC
tRPC accepts any Standard Schema-compliant object as an input validator. You can use a rawis.* guard chain or a defineSchemas schema directly in your procedure definition.
Integration with react-hook-form
react-hook-form’suseForm accepts a resolver option. Libraries like @hookform/resolvers provide Standard Schema support, meaning you pass your guard or schema directly as the resolver value.
GuardErr messages directly to react-hook-form’s errors object.
Integration with Drizzle
Drizzle’squeryClient and insert helpers accept Standard Schema validators for runtime validation of query inputs and results. Pass a guard or schema to Drizzle’s validation slot to enforce your types at the boundary between the database and your application code.
Any Standard Schema-compatible library
Because ts-chas implements the Standard Schema v1 protocol, any library that supports it works with ts-chas guards out of the box. The pattern is always the same: find the library’s validation slot and pass a guard chain or adefineSchemas schema directly.