TypeScript API / @laikacms/astro/loader / ZodNamespace
Interface: ZodNamespace
The slice of Zod's namespace this conversion uses.
Parameters are any on purpose. Zod brands its schemas with an internal _zod property, so a structurally-typed placeholder is not assignable to z.array's or z.object's parameters — and the whole namespace would then fail to match the real z a caller passes in. Widening the inputs is what keeps this a compatibility boundary rather than a reimplementation of Zod's type algebra. Return values stay opaque so our own code remains checked.
Properties
coerce
coerce: object;date()
date(): ZodTypeLike;Returns
Methods
array()
array(item): ZodTypeLike;Parameters
| Parameter | Type |
|---|---|
item | any |
Returns
boolean()
boolean(): ZodTypeLike;Returns
enum()
enum(values): ZodTypeLike;Parameters
| Parameter | Type |
|---|---|
values | any |
Returns
looseObject()
looseObject(shape): ZodTypeLike;A permissive object that keeps unknown keys.
Load-bearing: z.object({}) strips every key it does not declare, so using it as a placeholder schema would silently empty entry.data for every entry in the collection.
Parameters
| Parameter | Type |
|---|---|
shape | any |
Returns
number()
number(): ZodTypeLike;Returns
object()
object(shape): ZodTypeLike;Parameters
| Parameter | Type |
|---|---|
shape | any |
Returns
string()
string(): ZodTypeLike;Returns
union()
union(options): ZodTypeLike;Parameters
| Parameter | Type |
|---|---|
options | any |
Returns
unknown()
unknown(): ZodTypeLike;