Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 1.23 KB

File metadata and controls

24 lines (20 loc) · 1.23 KB

Examples

Runnable examples for TypKit. With the repo cloned and bun install done:

bun run examples/basic.ts        # check / assert / parse / infer
bun run examples/coercion.ts     # query-param coercion (string → typed)
bun run examples/json-schema.ts  # toJsonSchema() output
bun run examples/elysia.ts       # Elysia (native Standard Schema) — starts a server
bun run examples/hono.ts         # Hono validator middleware
File Shows
basic.ts Building a schema and the check / assert / parse surface, plus Infer.
coercion.ts t.coerce.number/boolean/date and t.default for query params.
json-schema.ts Exporting JSON Schema for OpenAPI / Swagger.
elysia.ts Using a schema directly as an Elysia body / query validator.
hono.ts The validator(target, schema) middleware from @myrialabs/typkit/middleware.
trpc.ts A TypKit schema as a tRPC input parser (needs @trpc/server).

Every schema is a Standard Schema, so the same schemas also work with react-hook-form, TanStack Form, and anything else that accepts one — no adapter required.