Zod Schema to TypeScript Type
Statically converts Zod schema source into the equivalent TypeScript types, the same ones z.infer would give you, without executing any code.
Use the tool
Why this tool exists
Sometimes you want the type behind a Zod schema written out in plain TypeScript: for a shared types package, a generated d.ts, documentation, or a service that does not install Zod. Hovering in your editor shows the inferred type but does not let you copy it cleanly. Paste the schema source here and the tool reads the z.object, z.enum, z.union, z.array and similar calls, applies optional, nullable and nullish, follows extend and merge, and prints interfaces and types. The code is parsed as text and never run. Results are limited where the output type cannot be known from the source, such as .transform() results and custom refinements. Everything stays in your browser.
How to use it
- Paste the Zod schema source, including the z.object declarations, into the input box.
- Run the conversion to see the TypeScript types.
- Copy the types, and check any field the tool marks as unknown.
Frequently asked questions
Does it execute my schema code?
No. It parses the text only. That is why dynamic code and imported schemas from other files cannot be resolved.
Which Zod features are covered?
Primitives, objects, arrays, tuples, records, enums, unions, optional, nullable, nullish, default, extend, merge, and describe. String checks such as min or email do not change the type.
What about transform and refine?
.transform() changes the output type in ways that cannot be worked out from the source, so such fields are not inferred accurately. Refinements do not change the type.
Why does a referenced schema show as unknown?
If a schema is imported from another file, the tool cannot see its definition. Paste it in alongside the schema that uses it.