一覧へ戻る
pykeio/zod-compiler(新しいタブで開きます)
主要言語: TypeScript
Speed up your Zod schemas / export TypeScript definitions
- star 数
- 5
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2025/04/23
主要言語: TypeScript
Speed up your Zod schemas / export TypeScript definitions
import z from 'zod'; const schema = z.object({ title: z.string().min(3).max(64), tags: z.array(z.string()).optional(), ... }); // ❌ slow! const { success, data, error } = schema.safeParse(input); // 🚀 import zc from 'zod-compiler'; const compiledSchema = zc.compile(schema); const { success, data, error } = compiledSchema.safeParse(input);
console.log(zc.types(schema)); // export type Schema = { // title: string; // tags?: string[]; // ... // };
$ npm i --save zod-compiler
Requires Zod 3.x and TypeScript 5.x to be installed.