zod 3.25.49 → 3.25.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/v4/classic/schemas.js +23 -22
- package/dist/cjs/v4/core/checks.js +2 -0
- package/dist/cjs/v4/core/core.js +2 -1
- package/dist/cjs/v4/core/schemas.js +1 -0
- package/dist/cjs/v4/mini/schemas.js +21 -27
- package/dist/esm/v4/classic/schemas.js +23 -22
- package/dist/esm/v4/core/checks.js +2 -0
- package/dist/esm/v4/core/core.js +2 -1
- package/dist/esm/v4/core/schemas.js +1 -0
- package/dist/esm/v4/mini/schemas.js +21 -27
- package/dist/types/v4/classic/coerce.d.ts +5 -5
- package/dist/types/v4/classic/schemas.d.ts +84 -118
- package/dist/types/v4/core/core.d.ts +3 -11
- package/dist/types/v4/core/schemas.d.ts +121 -108
- package/dist/types/v4/core/util.d.ts +2 -3
- package/dist/types/v4/mini/schemas.d.ts +31 -32
- package/package.json +1 -1
|
@@ -4,14 +4,17 @@ import * as parse from "./parse.js";
|
|
|
4
4
|
export interface RefinementCtx<T = unknown> extends core.ParsePayload<T> {
|
|
5
5
|
addIssue(arg: string | core.$ZodRawIssue | Partial<core.$ZodIssueCustom>): void;
|
|
6
6
|
}
|
|
7
|
-
export interface ZodType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
|
|
8
|
-
def:
|
|
7
|
+
export interface ZodType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
|
|
8
|
+
def: Internals["def"];
|
|
9
|
+
type: Internals["def"]["type"];
|
|
9
10
|
/** @deprecated Use `.def` instead. */
|
|
10
|
-
_def:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
_def: Internals["def"];
|
|
12
|
+
/** @deprecated Use `z.output<typeof schema>` instead. */
|
|
13
|
+
_output: Internals["output"];
|
|
14
|
+
/** @deprecated Use `z.input<typeof schema>` instead. */
|
|
15
|
+
_input: Internals["input"];
|
|
13
16
|
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
14
|
-
clone(def?:
|
|
17
|
+
clone(def?: Internals["def"], params?: {
|
|
15
18
|
parent: boolean;
|
|
16
19
|
}): this;
|
|
17
20
|
register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
|
|
@@ -34,8 +37,8 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
|
34
37
|
prefault(def: () => core.input<this>): ZodPrefault<this>;
|
|
35
38
|
prefault(def: core.input<this>): ZodPrefault<this>;
|
|
36
39
|
array(): ZodArray<this>;
|
|
37
|
-
or<T extends core
|
|
38
|
-
and<T extends core
|
|
40
|
+
or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>;
|
|
41
|
+
and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>;
|
|
39
42
|
transform<NewOut>(transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
|
|
40
43
|
catch(def: core.output<this>): ZodCatch<this>;
|
|
41
44
|
catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
|
|
@@ -66,9 +69,10 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
|
|
|
66
69
|
*/
|
|
67
70
|
isNullable(): boolean;
|
|
68
71
|
}
|
|
72
|
+
export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends ZodType<any, any, Internals> {
|
|
73
|
+
}
|
|
69
74
|
export declare const ZodType: core.$constructor<ZodType>;
|
|
70
|
-
export interface _ZodString<
|
|
71
|
-
_zod: core.$ZodStringInternals<Input>;
|
|
75
|
+
export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>> extends _ZodType<T> {
|
|
72
76
|
format: string | null;
|
|
73
77
|
minLength: number | null;
|
|
74
78
|
maxLength: number | null;
|
|
@@ -89,7 +93,7 @@ export interface _ZodString<Input = unknown> extends ZodType {
|
|
|
89
93
|
}
|
|
90
94
|
/** @internal */
|
|
91
95
|
export declare const _ZodString: core.$constructor<_ZodString>;
|
|
92
|
-
export interface ZodString extends _ZodString<string
|
|
96
|
+
export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
|
|
93
97
|
/** @deprecated Use `z.email()` instead. */
|
|
94
98
|
email(params?: string | core.$ZodCheckEmailParams): this;
|
|
95
99
|
/** @deprecated Use `z.url()` instead. */
|
|
@@ -147,8 +151,7 @@ export interface ZodString extends _ZodString<string> {
|
|
|
147
151
|
}
|
|
148
152
|
export declare const ZodString: core.$constructor<ZodString>;
|
|
149
153
|
export declare function string(params?: string | core.$ZodStringParams): ZodString;
|
|
150
|
-
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString {
|
|
151
|
-
_zod: core.$ZodStringFormatInternals<Format>;
|
|
154
|
+
export interface ZodStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats> extends _ZodString<core.$ZodStringFormatInternals<Format>> {
|
|
152
155
|
}
|
|
153
156
|
export declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
|
154
157
|
export interface ZodEmail extends ZodStringFormat<"email"> {
|
|
@@ -249,8 +252,7 @@ export interface ZodJWT extends ZodStringFormat<"jwt"> {
|
|
|
249
252
|
}
|
|
250
253
|
export declare const ZodJWT: core.$constructor<ZodJWT>;
|
|
251
254
|
export declare function jwt(params?: string | core.$ZodJWTParams): ZodJWT;
|
|
252
|
-
export interface _ZodNumber<
|
|
253
|
-
_zod: core.$ZodNumberInternals<Input>;
|
|
255
|
+
export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals> extends _ZodType<Internals> {
|
|
254
256
|
gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
255
257
|
/** Identical to .min() */
|
|
256
258
|
gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -280,7 +282,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
|
|
|
280
282
|
isFinite: boolean;
|
|
281
283
|
format: string | null;
|
|
282
284
|
}
|
|
283
|
-
export interface ZodNumber extends _ZodNumber<number
|
|
285
|
+
export interface ZodNumber extends _ZodNumber<core.$ZodNumberInternals<number>> {
|
|
284
286
|
}
|
|
285
287
|
export declare const ZodNumber: core.$constructor<ZodNumber>;
|
|
286
288
|
export declare function number(params?: string | core.$ZodNumberParams): ZodNumber;
|
|
@@ -303,15 +305,13 @@ export declare function int32(params?: string | core.$ZodCheckNumberFormatParams
|
|
|
303
305
|
export interface ZodUInt32 extends ZodNumberFormat {
|
|
304
306
|
}
|
|
305
307
|
export declare function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32;
|
|
306
|
-
export interface _ZodBoolean<T =
|
|
307
|
-
_zod: core.$ZodBooleanInternals<T>;
|
|
308
|
+
export interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals> extends _ZodType<T> {
|
|
308
309
|
}
|
|
309
|
-
export interface ZodBoolean extends _ZodBoolean<boolean
|
|
310
|
+
export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolean>> {
|
|
310
311
|
}
|
|
311
312
|
export declare const ZodBoolean: core.$constructor<ZodBoolean>;
|
|
312
313
|
export declare function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean;
|
|
313
|
-
export interface _ZodBigInt<T =
|
|
314
|
-
_zod: core.$ZodBigIntInternals<T>;
|
|
314
|
+
export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals> extends _ZodType<T> {
|
|
315
315
|
gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
316
316
|
/** Alias of `.gte()` */
|
|
317
317
|
min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
@@ -329,7 +329,7 @@ export interface _ZodBigInt<T = unknown> extends ZodType {
|
|
|
329
329
|
maxValue: bigint | null;
|
|
330
330
|
format: string | null;
|
|
331
331
|
}
|
|
332
|
-
export interface ZodBigInt extends _ZodBigInt<bigint
|
|
332
|
+
export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {
|
|
333
333
|
}
|
|
334
334
|
export declare const ZodBigInt: core.$constructor<ZodBigInt>;
|
|
335
335
|
export declare function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt;
|
|
@@ -339,46 +339,38 @@ export interface ZodBigIntFormat extends ZodBigInt {
|
|
|
339
339
|
export declare const ZodBigIntFormat: core.$constructor<ZodBigIntFormat>;
|
|
340
340
|
export declare function int64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
341
341
|
export declare function uint64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
342
|
-
export interface ZodSymbol extends
|
|
343
|
-
_zod: core.$ZodSymbolInternals;
|
|
342
|
+
export interface ZodSymbol extends _ZodType<core.$ZodSymbolInternals> {
|
|
344
343
|
}
|
|
345
344
|
export declare const ZodSymbol: core.$constructor<ZodSymbol>;
|
|
346
345
|
export declare function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol;
|
|
347
|
-
export interface ZodUndefined extends
|
|
348
|
-
_zod: core.$ZodUndefinedInternals;
|
|
346
|
+
export interface ZodUndefined extends _ZodType<core.$ZodUndefinedInternals> {
|
|
349
347
|
}
|
|
350
348
|
export declare const ZodUndefined: core.$constructor<ZodUndefined>;
|
|
351
349
|
declare function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined;
|
|
352
350
|
export { _undefined as undefined };
|
|
353
|
-
export interface ZodNull extends
|
|
354
|
-
_zod: core.$ZodNullInternals;
|
|
351
|
+
export interface ZodNull extends _ZodType<core.$ZodNullInternals> {
|
|
355
352
|
}
|
|
356
353
|
export declare const ZodNull: core.$constructor<ZodNull>;
|
|
357
354
|
declare function _null(params?: string | core.$ZodNullParams): ZodNull;
|
|
358
355
|
export { _null as null };
|
|
359
|
-
export interface ZodAny extends
|
|
360
|
-
_zod: core.$ZodAnyInternals;
|
|
356
|
+
export interface ZodAny extends _ZodType<core.$ZodAnyInternals> {
|
|
361
357
|
}
|
|
362
358
|
export declare const ZodAny: core.$constructor<ZodAny>;
|
|
363
359
|
export declare function any(): ZodAny;
|
|
364
|
-
export interface ZodUnknown extends
|
|
365
|
-
_zod: core.$ZodUnknownInternals;
|
|
360
|
+
export interface ZodUnknown extends _ZodType<core.$ZodUnknownInternals> {
|
|
366
361
|
}
|
|
367
362
|
export declare const ZodUnknown: core.$constructor<ZodUnknown>;
|
|
368
363
|
export declare function unknown(): ZodUnknown;
|
|
369
|
-
export interface ZodNever extends
|
|
370
|
-
_zod: core.$ZodNeverInternals;
|
|
364
|
+
export interface ZodNever extends _ZodType<core.$ZodNeverInternals> {
|
|
371
365
|
}
|
|
372
366
|
export declare const ZodNever: core.$constructor<ZodNever>;
|
|
373
367
|
export declare function never(params?: string | core.$ZodNeverParams): ZodNever;
|
|
374
|
-
export interface ZodVoid extends
|
|
375
|
-
_zod: core.$ZodVoidInternals;
|
|
368
|
+
export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {
|
|
376
369
|
}
|
|
377
370
|
export declare const ZodVoid: core.$constructor<ZodVoid>;
|
|
378
371
|
declare function _void(params?: string | core.$ZodVoidParams): ZodVoid;
|
|
379
372
|
export { _void as void };
|
|
380
|
-
export interface _ZodDate<T =
|
|
381
|
-
_zod: core.$ZodDateInternals<T>;
|
|
373
|
+
export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals> extends _ZodType<T> {
|
|
382
374
|
min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
383
375
|
max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
|
|
384
376
|
/** @deprecated Not recommended. */
|
|
@@ -386,12 +378,11 @@ export interface _ZodDate<T = unknown> extends ZodType {
|
|
|
386
378
|
/** @deprecated Not recommended. */
|
|
387
379
|
maxDate: Date | null;
|
|
388
380
|
}
|
|
389
|
-
export interface ZodDate extends _ZodDate<Date
|
|
381
|
+
export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {
|
|
390
382
|
}
|
|
391
383
|
export declare const ZodDate: core.$constructor<ZodDate>;
|
|
392
384
|
export declare function date(params?: string | core.$ZodDateParams): ZodDate;
|
|
393
|
-
export interface ZodArray<T extends core
|
|
394
|
-
_zod: core.$ZodArrayInternals<T>;
|
|
385
|
+
export interface ZodArray<T extends core.SomeType = core.$ZodType> extends ZodType<any, any, core.$ZodArrayInternals<T>>, core.$ZodArray<T> {
|
|
395
386
|
element: T;
|
|
396
387
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
397
388
|
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -400,16 +391,15 @@ export interface ZodArray<T extends core.$ZodType = core.$ZodType> extends ZodTy
|
|
|
400
391
|
unwrap(): T;
|
|
401
392
|
}
|
|
402
393
|
export declare const ZodArray: core.$constructor<ZodArray>;
|
|
403
|
-
export declare function array<T extends core
|
|
394
|
+
export declare function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
|
|
404
395
|
export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
|
|
405
396
|
export interface ZodObject<
|
|
406
397
|
/** @ts-ignore Cast variance */
|
|
407
|
-
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends
|
|
408
|
-
_zod: core.$ZodObjectInternals<Shape, Config>;
|
|
398
|
+
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
|
|
409
399
|
shape: Shape;
|
|
410
400
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
411
401
|
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
412
|
-
catchall<T extends core
|
|
402
|
+
catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>>;
|
|
413
403
|
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
414
404
|
passthrough(): ZodObject<Shape, core.$loose>;
|
|
415
405
|
/** Consider `z.looseObject(A.shape)` instead */
|
|
@@ -418,7 +408,7 @@ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.
|
|
|
418
408
|
strict(): ZodObject<Shape, core.$strict>;
|
|
419
409
|
/** This is the default behavior. This method call is likely unnecessary. */
|
|
420
410
|
strip(): ZodObject<Shape, core.$strict>;
|
|
421
|
-
extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core
|
|
411
|
+
extend<U extends core.$ZodLooseShape & Partial<Record<keyof Shape, core.SomeType>>>(shape: U): ZodObject<util.Extend<Shape, U>, Config>;
|
|
422
412
|
/**
|
|
423
413
|
* @deprecated Use spread syntax and the `.shape` property to combine two object schemas:
|
|
424
414
|
*
|
|
@@ -449,50 +439,44 @@ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.
|
|
|
449
439
|
}, Config>;
|
|
450
440
|
}
|
|
451
441
|
export declare const ZodObject: core.$constructor<ZodObject>;
|
|
452
|
-
export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core
|
|
442
|
+
export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T>, core.$strip>;
|
|
453
443
|
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict>;
|
|
454
444
|
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose>;
|
|
455
|
-
export interface ZodUnion<T extends readonly core
|
|
456
|
-
_zod: core.$ZodUnionInternals<T>;
|
|
445
|
+
export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]> extends _ZodType<core.$ZodUnionInternals<T>>, core.$ZodUnion<T> {
|
|
457
446
|
options: T;
|
|
458
447
|
}
|
|
459
448
|
export declare const ZodUnion: core.$constructor<ZodUnion>;
|
|
460
|
-
export declare function union<const T extends readonly core
|
|
461
|
-
export interface ZodDiscriminatedUnion<Options extends readonly core
|
|
449
|
+
export declare function union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
|
|
450
|
+
export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[]> extends ZodUnion<Options>, core.$ZodDiscriminatedUnion<Options> {
|
|
462
451
|
_zod: core.$ZodDiscriminatedUnionInternals<Options>;
|
|
463
452
|
}
|
|
464
453
|
export declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
465
454
|
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]]>(discriminator: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
|
|
466
|
-
export interface ZodIntersection<A extends core
|
|
467
|
-
_zod: core.$ZodIntersectionInternals<A, B>;
|
|
455
|
+
export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodIntersectionInternals<A, B>>, core.$ZodIntersection<A, B> {
|
|
468
456
|
}
|
|
469
457
|
export declare const ZodIntersection: core.$constructor<ZodIntersection>;
|
|
470
|
-
export declare function intersection<T extends core
|
|
471
|
-
export interface ZodTuple<T extends util.TupleItems =
|
|
472
|
-
|
|
473
|
-
rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
458
|
+
export declare function intersection<T extends core.SomeType, U extends core.SomeType>(left: T, right: U): ZodIntersection<T, U>;
|
|
459
|
+
export interface ZodTuple<T extends util.TupleItems = readonly core.$ZodType[], Rest extends core.SomeType | null = core.$ZodType | null> extends _ZodType<core.$ZodTupleInternals<T, Rest>>, core.$ZodTuple<T, Rest> {
|
|
460
|
+
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
474
461
|
}
|
|
475
462
|
export declare const ZodTuple: core.$constructor<ZodTuple>;
|
|
476
|
-
export declare function tuple<T extends readonly [core
|
|
477
|
-
export declare function tuple<T extends readonly [core
|
|
463
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null>;
|
|
464
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest>;
|
|
478
465
|
export declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
|
|
479
|
-
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core
|
|
480
|
-
_zod: core.$ZodRecordInternals<Key, Value>;
|
|
466
|
+
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodRecordInternals<Key, Value>>, core.$ZodRecord<Key, Value> {
|
|
481
467
|
keyType: Key;
|
|
482
468
|
valueType: Value;
|
|
483
469
|
}
|
|
484
470
|
export declare const ZodRecord: core.$constructor<ZodRecord>;
|
|
485
|
-
export declare function record<Key extends core.$ZodRecordKey, Value extends core
|
|
486
|
-
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core
|
|
487
|
-
export interface ZodMap<Key extends core
|
|
488
|
-
_zod: core.$ZodMapInternals<Key, Value>;
|
|
471
|
+
export declare function record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value>;
|
|
472
|
+
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
|
|
473
|
+
export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodMapInternals<Key, Value>>, core.$ZodMap<Key, Value> {
|
|
489
474
|
keyType: Key;
|
|
490
475
|
valueType: Value;
|
|
491
476
|
}
|
|
492
477
|
export declare const ZodMap: core.$constructor<ZodMap>;
|
|
493
|
-
export declare function map<Key extends core
|
|
494
|
-
export interface ZodSet<T extends core
|
|
495
|
-
_zod: core.$ZodSetInternals<T>;
|
|
478
|
+
export declare function map<Key extends core.SomeType, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
|
|
479
|
+
export interface ZodSet<T extends core.SomeType = core.$ZodType> extends ZodType<any, any, core.$ZodSetInternals<T>>, core.$ZodSet<T> {
|
|
496
480
|
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
497
481
|
/** */
|
|
498
482
|
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
@@ -500,9 +484,8 @@ export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType
|
|
|
500
484
|
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
|
501
485
|
}
|
|
502
486
|
export declare const ZodSet: core.$constructor<ZodSet>;
|
|
503
|
-
export declare function set<Value extends core
|
|
504
|
-
export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends
|
|
505
|
-
_zod: core.$ZodEnumInternals<T>;
|
|
487
|
+
export declare function set<Value extends core.SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value>;
|
|
488
|
+
export interface ZodEnum<out T extends util.EnumLike = util.EnumLike> extends _ZodType<core.$ZodEnumInternals<T>>, core.$ZodEnum<T> {
|
|
506
489
|
enum: T;
|
|
507
490
|
options: Array<T[keyof T]>;
|
|
508
491
|
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
|
|
@@ -520,8 +503,7 @@ export { _enum as enum };
|
|
|
520
503
|
* ```
|
|
521
504
|
*/
|
|
522
505
|
export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
|
|
523
|
-
export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends
|
|
524
|
-
_zod: core.$ZodLiteralInternals<T>;
|
|
506
|
+
export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends _ZodType<core.$ZodLiteralInternals<T>>, core.$ZodLiteral<T> {
|
|
525
507
|
values: Set<T>;
|
|
526
508
|
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
527
509
|
value: T;
|
|
@@ -529,103 +511,87 @@ export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends Z
|
|
|
529
511
|
export declare const ZodLiteral: core.$constructor<ZodLiteral>;
|
|
530
512
|
export declare function literal<const T extends Array<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number]>;
|
|
531
513
|
export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T>;
|
|
532
|
-
export interface ZodFile extends
|
|
533
|
-
_zod: core.$ZodFileInternals;
|
|
514
|
+
export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
|
|
534
515
|
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
535
516
|
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
536
517
|
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
537
518
|
}
|
|
538
519
|
export declare const ZodFile: core.$constructor<ZodFile>;
|
|
539
520
|
export declare function file(params?: string | core.$ZodFileParams): ZodFile;
|
|
540
|
-
export interface ZodTransform<O = unknown, I = unknown> extends
|
|
541
|
-
_zod: core.$ZodTransformInternals<O, I>;
|
|
521
|
+
export interface ZodTransform<O = unknown, I = unknown> extends _ZodType<core.$ZodTransformInternals<O, I>>, core.$ZodTransform<O, I> {
|
|
542
522
|
}
|
|
543
523
|
export declare const ZodTransform: core.$constructor<ZodTransform>;
|
|
544
524
|
export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O): ZodTransform<Awaited<O>, I>;
|
|
545
|
-
export interface ZodOptional<T extends core
|
|
546
|
-
_zod: core.$ZodOptionalInternals<T>;
|
|
525
|
+
export interface ZodOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodOptionalInternals<T>>, core.$ZodOptional<T> {
|
|
547
526
|
unwrap(): T;
|
|
548
527
|
}
|
|
549
528
|
export declare const ZodOptional: core.$constructor<ZodOptional>;
|
|
550
|
-
export declare function optional<T extends core
|
|
551
|
-
export interface ZodNullable<T extends core
|
|
552
|
-
_zod: core.$ZodNullableInternals<T>;
|
|
529
|
+
export declare function optional<T extends core.SomeType>(innerType: T): ZodOptional<T>;
|
|
530
|
+
export interface ZodNullable<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNullableInternals<T>>, core.$ZodNullable<T> {
|
|
553
531
|
unwrap(): T;
|
|
554
532
|
}
|
|
555
533
|
export declare const ZodNullable: core.$constructor<ZodNullable>;
|
|
556
|
-
export declare function nullable<T extends core
|
|
557
|
-
export declare function nullish<T extends core
|
|
558
|
-
export interface ZodDefault<T extends core
|
|
559
|
-
_zod: core.$ZodDefaultInternals<T>;
|
|
534
|
+
export declare function nullable<T extends core.SomeType>(innerType: T): ZodNullable<T>;
|
|
535
|
+
export declare function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodNullable<T>>;
|
|
536
|
+
export interface ZodDefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodDefaultInternals<T>>, core.$ZodDefault<T> {
|
|
560
537
|
unwrap(): T;
|
|
561
538
|
/** @deprecated Use `.unwrap()` instead. */
|
|
562
539
|
removeDefault(): T;
|
|
563
540
|
}
|
|
564
541
|
export declare const ZodDefault: core.$constructor<ZodDefault>;
|
|
565
|
-
export declare function _default<T extends core
|
|
566
|
-
export interface ZodPrefault<T extends core
|
|
567
|
-
_zod: core.$ZodPrefaultInternals<T>;
|
|
542
|
+
export declare function _default<T extends core.SomeType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): ZodDefault<T>;
|
|
543
|
+
export interface ZodPrefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPrefaultInternals<T>>, core.$ZodPrefault<T> {
|
|
568
544
|
unwrap(): T;
|
|
569
545
|
}
|
|
570
546
|
export declare const ZodPrefault: core.$constructor<ZodPrefault>;
|
|
571
|
-
export declare function prefault<T extends core
|
|
572
|
-
export interface ZodNonOptional<T extends core
|
|
573
|
-
_zod: core.$ZodNonOptionalInternals<T>;
|
|
547
|
+
export declare function prefault<T extends core.SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodPrefault<T>;
|
|
548
|
+
export interface ZodNonOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNonOptionalInternals<T>>, core.$ZodNonOptional<T> {
|
|
574
549
|
unwrap(): T;
|
|
575
550
|
}
|
|
576
551
|
export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
|
|
577
|
-
export declare function nonoptional<T extends core
|
|
578
|
-
export interface ZodSuccess<T extends core
|
|
579
|
-
_zod: core.$ZodSuccessInternals<T>;
|
|
552
|
+
export declare function nonoptional<T extends core.SomeType>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T>;
|
|
553
|
+
export interface ZodSuccess<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSuccessInternals<T>>, core.$ZodSuccess<T> {
|
|
580
554
|
unwrap(): T;
|
|
581
555
|
}
|
|
582
556
|
export declare const ZodSuccess: core.$constructor<ZodSuccess>;
|
|
583
|
-
export declare function success<T extends core
|
|
584
|
-
export interface ZodCatch<T extends core
|
|
585
|
-
_zod: core.$ZodCatchInternals<T>;
|
|
557
|
+
export declare function success<T extends core.SomeType>(innerType: T): ZodSuccess<T>;
|
|
558
|
+
export interface ZodCatch<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodCatchInternals<T>>, core.$ZodCatch<T> {
|
|
586
559
|
unwrap(): T;
|
|
587
560
|
/** @deprecated Use `.unwrap()` instead. */
|
|
588
561
|
removeCatch(): T;
|
|
589
562
|
}
|
|
590
563
|
export declare const ZodCatch: core.$constructor<ZodCatch>;
|
|
591
|
-
declare function _catch<T extends core
|
|
564
|
+
declare function _catch<T extends core.SomeType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)): ZodCatch<T>;
|
|
592
565
|
export { _catch as catch };
|
|
593
|
-
export interface ZodNaN extends
|
|
594
|
-
_zod: core.$ZodNaNInternals;
|
|
566
|
+
export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
|
|
595
567
|
}
|
|
596
568
|
export declare const ZodNaN: core.$constructor<ZodNaN>;
|
|
597
569
|
export declare function nan(params?: string | core.$ZodNaNParams): ZodNaN;
|
|
598
|
-
export interface ZodPipe<A extends core
|
|
599
|
-
_zod: core.$ZodPipeInternals<A, B>;
|
|
570
|
+
export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPipeInternals<A, B>>, core.$ZodPipe<A, B> {
|
|
600
571
|
in: A;
|
|
601
572
|
out: B;
|
|
602
573
|
}
|
|
603
574
|
export declare const ZodPipe: core.$constructor<ZodPipe>;
|
|
604
|
-
export declare function pipe<const A extends core
|
|
605
|
-
export interface ZodReadonly<T extends core
|
|
606
|
-
_zod: core.$ZodReadonlyInternals<T>;
|
|
575
|
+
export declare function pipe<const A extends core.SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B>;
|
|
576
|
+
export interface ZodReadonly<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodReadonlyInternals<T>>, core.$ZodReadonly<T> {
|
|
607
577
|
}
|
|
608
578
|
export declare const ZodReadonly: core.$constructor<ZodReadonly>;
|
|
609
|
-
export declare function readonly<T extends core
|
|
610
|
-
export interface ZodTemplateLiteral<Template extends string = string> extends
|
|
611
|
-
_zod: core.$ZodTemplateLiteralInternals<Template>;
|
|
579
|
+
export declare function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T>;
|
|
580
|
+
export interface ZodTemplateLiteral<Template extends string = string> extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>, core.$ZodTemplateLiteral<Template> {
|
|
612
581
|
}
|
|
613
582
|
export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
|
|
614
583
|
export declare function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
|
|
615
|
-
export interface ZodLazy<T extends core
|
|
616
|
-
_zod: core.$ZodLazyInternals<T>;
|
|
584
|
+
export interface ZodLazy<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodLazyInternals<T>>, core.$ZodLazy<T> {
|
|
617
585
|
unwrap(): T;
|
|
618
586
|
}
|
|
619
587
|
export declare const ZodLazy: core.$constructor<ZodLazy>;
|
|
620
|
-
export declare function lazy<T extends core
|
|
621
|
-
export interface ZodPromise<T extends core
|
|
622
|
-
_zod: core.$ZodPromiseInternals<T>;
|
|
588
|
+
export declare function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T>;
|
|
589
|
+
export interface ZodPromise<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPromiseInternals<T>>, core.$ZodPromise<T> {
|
|
623
590
|
unwrap(): T;
|
|
624
591
|
}
|
|
625
592
|
export declare const ZodPromise: core.$constructor<ZodPromise>;
|
|
626
|
-
export declare function promise<T extends core
|
|
627
|
-
export interface ZodCustom<O = unknown, I = unknown> extends
|
|
628
|
-
_zod: core.$ZodCustomInternals<O, I>;
|
|
593
|
+
export declare function promise<T extends core.SomeType>(innerType: T): ZodPromise<T>;
|
|
594
|
+
export interface ZodCustom<O = unknown, I = unknown> extends _ZodType<core.$ZodCustomInternals<O, I>>, core.$ZodCustom<O, I> {
|
|
629
595
|
}
|
|
630
596
|
export declare const ZodCustom: core.$constructor<ZodCustom>;
|
|
631
597
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
@@ -650,4 +616,4 @@ export type ZodJSONSchema = ZodUnion<[
|
|
|
650
616
|
};
|
|
651
617
|
};
|
|
652
618
|
export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
|
|
653
|
-
export declare function preprocess<A, U extends core
|
|
619
|
+
export declare function preprocess<A, U extends core.SomeType>(fn: (arg: unknown, ctx: RefinementCtx) => A, schema: U): ZodPipe<ZodTransform<A, unknown>, U>;
|
|
@@ -20,28 +20,20 @@ export type $brand<T extends string | number | symbol = string | number | symbol
|
|
|
20
20
|
[k in T]: true;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
export type $ZodBranded<T extends schemas
|
|
23
|
+
export type $ZodBranded<T extends schemas._$ZodType, Brand extends string | number | symbol> = T & Record<"_zod", Record<"output", output<T> & $brand<Brand>>>;
|
|
24
24
|
export declare class $ZodAsyncError extends Error {
|
|
25
25
|
constructor();
|
|
26
26
|
}
|
|
27
27
|
export type input<T> = T extends {
|
|
28
|
-
_zod: {
|
|
29
|
-
"~input": any;
|
|
30
|
-
};
|
|
31
|
-
} ? T["_zod"]["~input"] : T extends {
|
|
32
28
|
_zod: {
|
|
33
29
|
input: any;
|
|
34
30
|
};
|
|
35
|
-
} ? T["_zod"]["input"] :
|
|
31
|
+
} ? Required<T["_zod"]>["input"] : unknown;
|
|
36
32
|
export type output<T> = T extends {
|
|
37
|
-
_zod: {
|
|
38
|
-
"~output": any;
|
|
39
|
-
};
|
|
40
|
-
} ? T["_zod"]["~output"] : T extends {
|
|
41
33
|
_zod: {
|
|
42
34
|
output: any;
|
|
43
35
|
};
|
|
44
|
-
} ? T["_zod"]["output"] :
|
|
36
|
+
} ? Required<T["_zod"]>["output"] : unknown;
|
|
45
37
|
export type { output as infer };
|
|
46
38
|
export interface $ZodConfig {
|
|
47
39
|
/** Custom error map. Overrides `config().localeError`. */
|