Skip to content

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 ​

ts
coerce: object;

date() ​

ts
date(): ZodTypeLike;
Returns ​

ZodTypeLike

Methods ​

array() ​

ts
array(item): ZodTypeLike;

Parameters ​

ParameterType
itemany

Returns ​

ZodTypeLike


boolean() ​

ts
boolean(): ZodTypeLike;

Returns ​

ZodTypeLike


enum() ​

ts
enum(values): ZodTypeLike;

Parameters ​

ParameterType
valuesany

Returns ​

ZodTypeLike


looseObject() ​

ts
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 ​

ParameterType
shapeany

Returns ​

ZodTypeLike


number() ​

ts
number(): ZodTypeLike;

Returns ​

ZodTypeLike


object() ​

ts
object(shape): ZodTypeLike;

Parameters ​

ParameterType
shapeany

Returns ​

ZodTypeLike


string() ​

ts
string(): ZodTypeLike;

Returns ​

ZodTypeLike


union() ​

ts
union(options): ZodTypeLike;

Parameters ​

ParameterType
optionsany

Returns ​

ZodTypeLike


unknown() ​

ts
unknown(): ZodTypeLike;

Returns ​

ZodTypeLike

Released under the MIT License.