Skip to content

API reference > @kontsedal/olas-zod > UnwrapZod

UnwrapZod type ​

A Zod schema with its .default(), .optional() and .nullable() wrappers stripped — the type-level twin of the runtime unwrap createZodForm does before choosing a leaf.

Signature:

typescript
export type UnwrapZod<S> = S extends z.ZodDefault<infer Inner> ? UnwrapZod<Inner> : S extends z.ZodOptional<infer Inner> ? UnwrapZod<Inner> : S extends z.ZodNullable<infer Inner> ? UnwrapZod<Inner> : S;

References: UnwrapZod

Released under the MIT License.