zod 3.24.0 → 3.24.2
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/README.md +62 -16
- package/lib/ZodError.d.ts +16 -16
- package/lib/ZodError.js +3 -3
- package/lib/external.js +5 -1
- package/lib/helpers/errorUtil.d.ts +2 -2
- package/lib/helpers/errorUtil.js +1 -1
- package/lib/helpers/parseUtil.d.ts +11 -11
- package/lib/helpers/parseUtil.js +3 -3
- package/lib/helpers/typeAliases.d.ts +2 -2
- package/lib/helpers/util.d.ts +9 -9
- package/lib/helpers/util.js +2 -2
- package/lib/index.js +5 -1
- package/lib/index.mjs +80 -55
- package/lib/index.umd.js +80 -55
- package/lib/standard-schema.d.ts +1 -1
- package/lib/types.d.ts +130 -221
- package/lib/types.js +75 -50
- package/package.json +2 -2
package/lib/types.d.ts
CHANGED
|
@@ -10,42 +10,42 @@ export interface RefinementCtx {
|
|
|
10
10
|
addIssue: (arg: IssueData) => void;
|
|
11
11
|
path: (string | number)[];
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type ZodRawShape = {
|
|
14
14
|
[k: string]: ZodTypeAny;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
16
|
+
export type ZodTypeAny = ZodType<any, any, any>;
|
|
17
|
+
export type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
18
|
+
export type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
19
|
+
export type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
20
20
|
export type { TypeOf as infer };
|
|
21
|
-
export
|
|
21
|
+
export type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
22
22
|
export interface ZodTypeDef {
|
|
23
23
|
errorMap?: ZodErrorMap;
|
|
24
24
|
description?: string;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type RawCreateParams = {
|
|
27
27
|
errorMap?: ZodErrorMap;
|
|
28
28
|
invalid_type_error?: string;
|
|
29
29
|
required_error?: string;
|
|
30
30
|
message?: string;
|
|
31
31
|
description?: string;
|
|
32
32
|
} | undefined;
|
|
33
|
-
export
|
|
33
|
+
export type ProcessedCreateParams = {
|
|
34
34
|
errorMap?: ZodErrorMap;
|
|
35
35
|
description?: string;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type SafeParseSuccess<Output> = {
|
|
38
38
|
success: true;
|
|
39
39
|
data: Output;
|
|
40
40
|
error?: never;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type SafeParseError<Input> = {
|
|
43
43
|
success: false;
|
|
44
44
|
error: ZodError<Input>;
|
|
45
45
|
data?: never;
|
|
46
46
|
};
|
|
47
|
-
export
|
|
48
|
-
export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output>
|
|
47
|
+
export type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
48
|
+
export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
49
49
|
readonly _type: Output;
|
|
50
50
|
readonly _output: Output;
|
|
51
51
|
readonly _input: Input;
|
|
@@ -67,7 +67,7 @@ export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = Zod
|
|
|
67
67
|
parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
|
|
68
68
|
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
69
69
|
/** Alias of safeParseAsync */
|
|
70
|
-
spa: (data: unknown, params?: Partial<ParseParams>
|
|
70
|
+
spa: (data: unknown, params?: Partial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
|
|
71
71
|
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
72
72
|
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
73
73
|
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
@@ -99,8 +99,8 @@ export declare abstract class ZodType<Output = any, Def extends ZodTypeDef = Zod
|
|
|
99
99
|
isOptional(): boolean;
|
|
100
100
|
isNullable(): boolean;
|
|
101
101
|
}
|
|
102
|
-
export
|
|
103
|
-
export
|
|
102
|
+
export type IpVersion = "v4" | "v6";
|
|
103
|
+
export type ZodStringCheck = {
|
|
104
104
|
kind: "min";
|
|
105
105
|
value: number;
|
|
106
106
|
message?: string;
|
|
@@ -256,8 +256,7 @@ export declare class ZodString extends ZodType<string, ZodStringDef, string> {
|
|
|
256
256
|
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
257
257
|
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @see {@link ZodString.min}
|
|
259
|
+
* Equivalent to `.min(1)`
|
|
261
260
|
*/
|
|
262
261
|
nonempty(message?: errorUtil.ErrMessage): ZodString;
|
|
263
262
|
trim(): ZodString;
|
|
@@ -281,17 +280,11 @@ export declare class ZodString extends ZodType<string, ZodStringDef, string> {
|
|
|
281
280
|
get isBase64url(): boolean;
|
|
282
281
|
get minLength(): number | null;
|
|
283
282
|
get maxLength(): number | null;
|
|
284
|
-
static create: (params?:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
required_error?: string | undefined;
|
|
288
|
-
message?: string | undefined;
|
|
289
|
-
description?: string | undefined;
|
|
290
|
-
} & {
|
|
291
|
-
coerce?: true | undefined;
|
|
292
|
-
}) | undefined) => ZodString;
|
|
283
|
+
static create: (params?: RawCreateParams & {
|
|
284
|
+
coerce?: true;
|
|
285
|
+
}) => ZodString;
|
|
293
286
|
}
|
|
294
|
-
export
|
|
287
|
+
export type ZodNumberCheck = {
|
|
295
288
|
kind: "min";
|
|
296
289
|
value: number;
|
|
297
290
|
inclusive: boolean;
|
|
@@ -319,20 +312,14 @@ export interface ZodNumberDef extends ZodTypeDef {
|
|
|
319
312
|
}
|
|
320
313
|
export declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
321
314
|
_parse(input: ParseInput): ParseReturnType<number>;
|
|
322
|
-
static create: (params?:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
required_error?: string | undefined;
|
|
326
|
-
message?: string | undefined;
|
|
327
|
-
description?: string | undefined;
|
|
328
|
-
} & {
|
|
329
|
-
coerce?: boolean | undefined;
|
|
330
|
-
}) | undefined) => ZodNumber;
|
|
315
|
+
static create: (params?: RawCreateParams & {
|
|
316
|
+
coerce?: boolean;
|
|
317
|
+
}) => ZodNumber;
|
|
331
318
|
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
332
|
-
min: (value: number, message?: errorUtil.ErrMessage
|
|
319
|
+
min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
333
320
|
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
334
321
|
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
335
|
-
max: (value: number, message?: errorUtil.ErrMessage
|
|
322
|
+
max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
336
323
|
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
337
324
|
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
338
325
|
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
@@ -342,7 +329,7 @@ export declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
|
342
329
|
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
343
330
|
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
344
331
|
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
345
|
-
step: (value: number, message?: errorUtil.ErrMessage
|
|
332
|
+
step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
|
|
346
333
|
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
347
334
|
safe(message?: errorUtil.ErrMessage): ZodNumber;
|
|
348
335
|
get minValue(): number | null;
|
|
@@ -350,7 +337,7 @@ export declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
|
|
|
350
337
|
get isInt(): boolean;
|
|
351
338
|
get isFinite(): boolean;
|
|
352
339
|
}
|
|
353
|
-
export
|
|
340
|
+
export type ZodBigIntCheck = {
|
|
354
341
|
kind: "min";
|
|
355
342
|
value: bigint;
|
|
356
343
|
inclusive: boolean;
|
|
@@ -373,20 +360,14 @@ export interface ZodBigIntDef extends ZodTypeDef {
|
|
|
373
360
|
export declare class ZodBigInt extends ZodType<bigint, ZodBigIntDef, bigint> {
|
|
374
361
|
_parse(input: ParseInput): ParseReturnType<bigint>;
|
|
375
362
|
_getInvalidInput(input: ParseInput): INVALID;
|
|
376
|
-
static create: (params?:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
required_error?: string | undefined;
|
|
380
|
-
message?: string | undefined;
|
|
381
|
-
description?: string | undefined;
|
|
382
|
-
} & {
|
|
383
|
-
coerce?: boolean | undefined;
|
|
384
|
-
}) | undefined) => ZodBigInt;
|
|
363
|
+
static create: (params?: RawCreateParams & {
|
|
364
|
+
coerce?: boolean;
|
|
365
|
+
}) => ZodBigInt;
|
|
385
366
|
gte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
386
|
-
min: (value: bigint, message?: errorUtil.ErrMessage
|
|
367
|
+
min: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
387
368
|
gt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
388
369
|
lte(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
389
|
-
max: (value: bigint, message?: errorUtil.ErrMessage
|
|
370
|
+
max: (value: bigint, message?: errorUtil.ErrMessage) => ZodBigInt;
|
|
390
371
|
lt(value: bigint, message?: errorUtil.ErrMessage): ZodBigInt;
|
|
391
372
|
protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): ZodBigInt;
|
|
392
373
|
_addCheck(check: ZodBigIntCheck): ZodBigInt;
|
|
@@ -404,17 +385,11 @@ export interface ZodBooleanDef extends ZodTypeDef {
|
|
|
404
385
|
}
|
|
405
386
|
export declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef, boolean> {
|
|
406
387
|
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
407
|
-
static create: (params?:
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
required_error?: string | undefined;
|
|
411
|
-
message?: string | undefined;
|
|
412
|
-
description?: string | undefined;
|
|
413
|
-
} & {
|
|
414
|
-
coerce?: boolean | undefined;
|
|
415
|
-
}) | undefined) => ZodBoolean;
|
|
388
|
+
static create: (params?: RawCreateParams & {
|
|
389
|
+
coerce?: boolean;
|
|
390
|
+
}) => ZodBoolean;
|
|
416
391
|
}
|
|
417
|
-
export
|
|
392
|
+
export type ZodDateCheck = {
|
|
418
393
|
kind: "min";
|
|
419
394
|
value: number;
|
|
420
395
|
message?: string;
|
|
@@ -435,15 +410,9 @@ export declare class ZodDate extends ZodType<Date, ZodDateDef, Date> {
|
|
|
435
410
|
max(maxDate: Date, message?: errorUtil.ErrMessage): ZodDate;
|
|
436
411
|
get minDate(): Date | null;
|
|
437
412
|
get maxDate(): Date | null;
|
|
438
|
-
static create: (params?:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
required_error?: string | undefined;
|
|
442
|
-
message?: string | undefined;
|
|
443
|
-
description?: string | undefined;
|
|
444
|
-
} & {
|
|
445
|
-
coerce?: boolean | undefined;
|
|
446
|
-
}) | undefined) => ZodDate;
|
|
413
|
+
static create: (params?: RawCreateParams & {
|
|
414
|
+
coerce?: boolean;
|
|
415
|
+
}) => ZodDate;
|
|
447
416
|
}
|
|
448
417
|
export interface ZodSymbolDef extends ZodTypeDef {
|
|
449
418
|
typeName: ZodFirstPartyTypeKind.ZodSymbol;
|
|
@@ -513,8 +482,8 @@ export interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeD
|
|
|
513
482
|
message?: string;
|
|
514
483
|
} | null;
|
|
515
484
|
}
|
|
516
|
-
export
|
|
517
|
-
export
|
|
485
|
+
export type ArrayCardinality = "many" | "atleastone";
|
|
486
|
+
export type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
518
487
|
export declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
|
|
519
488
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
520
489
|
get element(): T;
|
|
@@ -524,37 +493,37 @@ export declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCar
|
|
|
524
493
|
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
525
494
|
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
|
|
526
495
|
}
|
|
527
|
-
export
|
|
528
|
-
export
|
|
496
|
+
export type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
497
|
+
export type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
529
498
|
export interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
530
499
|
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
531
500
|
shape: () => T;
|
|
532
501
|
catchall: Catchall;
|
|
533
502
|
unknownKeys: UnknownKeys;
|
|
534
503
|
}
|
|
535
|
-
export
|
|
504
|
+
export type mergeTypes<A, B> = {
|
|
536
505
|
[k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
|
|
537
506
|
};
|
|
538
|
-
export
|
|
539
|
-
export
|
|
507
|
+
export type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
508
|
+
export type baseObjectOutputType<Shape extends ZodRawShape> = {
|
|
540
509
|
[k in keyof Shape]: Shape[k]["_output"];
|
|
541
510
|
};
|
|
542
|
-
export
|
|
543
|
-
export
|
|
511
|
+
export type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
512
|
+
export type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
544
513
|
[k in keyof Shape]: Shape[k]["_input"];
|
|
545
514
|
}>;
|
|
546
|
-
export
|
|
515
|
+
export type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
547
516
|
[k: string]: T["_output"];
|
|
548
517
|
};
|
|
549
|
-
export
|
|
518
|
+
export type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
|
|
550
519
|
[k: string]: T["_input"];
|
|
551
520
|
};
|
|
552
|
-
export
|
|
521
|
+
export type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
553
522
|
[k: string]: unknown;
|
|
554
523
|
} : unknown;
|
|
555
|
-
export
|
|
556
|
-
export
|
|
557
|
-
export
|
|
524
|
+
export type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
525
|
+
export type SomeZodObject = ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
526
|
+
export type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
558
527
|
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
559
528
|
};
|
|
560
529
|
export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
@@ -577,7 +546,7 @@ export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends Unknow
|
|
|
577
546
|
/**
|
|
578
547
|
* @deprecated Use `.extend` instead
|
|
579
548
|
* */
|
|
580
|
-
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall
|
|
549
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
581
550
|
/**
|
|
582
551
|
* Prior to zod@1.0.12 there was a bug in the
|
|
583
552
|
* inferred type of merged objects. Please
|
|
@@ -615,12 +584,12 @@ export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends Unknow
|
|
|
615
584
|
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
616
585
|
}>, UnknownKeys, Catchall>;
|
|
617
586
|
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
618
|
-
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny,
|
|
619
|
-
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny,
|
|
620
|
-
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny,
|
|
587
|
+
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
|
|
588
|
+
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
|
|
589
|
+
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any> extends infer T_2 ? { [k in keyof T_2]: objectUtil.addQuestionMarks<baseObjectOutputType<T_1>, any>[k]; } : never, baseObjectInputType<T_1> extends infer T_3 ? { [k_1 in keyof T_3]: baseObjectInputType<T_1>[k_1]; } : never>;
|
|
621
590
|
}
|
|
622
|
-
export
|
|
623
|
-
export
|
|
591
|
+
export type AnyZodObject = ZodObject<any, any, any>;
|
|
592
|
+
export type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
624
593
|
export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
|
|
625
594
|
ZodTypeAny,
|
|
626
595
|
ZodTypeAny,
|
|
@@ -634,7 +603,7 @@ export declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[numbe
|
|
|
634
603
|
get options(): T;
|
|
635
604
|
static create: <T_1 extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
|
|
636
605
|
}
|
|
637
|
-
export
|
|
606
|
+
export type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
|
|
638
607
|
[key in Discriminator]: ZodTypeAny;
|
|
639
608
|
} & ZodRawShape, UnknownKeysParam, ZodTypeAny>;
|
|
640
609
|
export interface ZodDiscriminatedUnionDef<Discriminator extends string, Options extends readonly ZodDiscriminatedUnionOption<string>[] = ZodDiscriminatedUnionOption<string>[]> extends ZodTypeDef {
|
|
@@ -670,22 +639,22 @@ export declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny>
|
|
|
670
639
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
671
640
|
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
|
|
672
641
|
}
|
|
673
|
-
export
|
|
674
|
-
export
|
|
675
|
-
export
|
|
642
|
+
export type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
643
|
+
export type AssertArray<T> = T extends any[] ? T : never;
|
|
644
|
+
export type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
676
645
|
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never;
|
|
677
646
|
}>;
|
|
678
|
-
export
|
|
679
|
-
export
|
|
647
|
+
export type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
648
|
+
export type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
680
649
|
[k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never;
|
|
681
650
|
}>;
|
|
682
|
-
export
|
|
651
|
+
export type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
683
652
|
export interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
684
653
|
items: T;
|
|
685
654
|
rest: Rest;
|
|
686
655
|
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
687
656
|
}
|
|
688
|
-
export
|
|
657
|
+
export type AnyZodTuple = ZodTuple<[
|
|
689
658
|
ZodTypeAny,
|
|
690
659
|
...ZodTypeAny[]
|
|
691
660
|
] | [], ZodTypeAny | null>;
|
|
@@ -700,8 +669,8 @@ export interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends Z
|
|
|
700
669
|
keyType: Key;
|
|
701
670
|
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
702
671
|
}
|
|
703
|
-
export
|
|
704
|
-
export
|
|
672
|
+
export type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
673
|
+
export type RecordType<K extends string | number | symbol, V> = [
|
|
705
674
|
string
|
|
706
675
|
] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : [BRAND<string | number | symbol>] extends [K] ? Record<K, V> : Partial<Record<K, V>>;
|
|
707
676
|
export declare class ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<RecordType<Key["_output"], Value["_output"]>, ZodRecordDef<Key, Value>, RecordType<Key["_input"], Value["_input"]>> {
|
|
@@ -748,8 +717,8 @@ export interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any,
|
|
|
748
717
|
returns: Returns;
|
|
749
718
|
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
750
719
|
}
|
|
751
|
-
export
|
|
752
|
-
export
|
|
720
|
+
export type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
721
|
+
export type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
753
722
|
export declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
754
723
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
755
724
|
parameters(): Args;
|
|
@@ -782,21 +751,21 @@ export declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
|
782
751
|
get value(): T;
|
|
783
752
|
static create: <T_1 extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
|
|
784
753
|
}
|
|
785
|
-
export
|
|
786
|
-
export
|
|
787
|
-
export
|
|
788
|
-
export
|
|
754
|
+
export type ArrayKeys = keyof any[];
|
|
755
|
+
export type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
756
|
+
export type EnumValues<T extends string = string> = readonly [T, ...T[]];
|
|
757
|
+
export type Values<T extends EnumValues> = {
|
|
789
758
|
[k in T[number]]: k;
|
|
790
759
|
};
|
|
791
760
|
export interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
792
761
|
values: T;
|
|
793
762
|
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
794
763
|
}
|
|
795
|
-
export
|
|
764
|
+
export type Writeable<T> = {
|
|
796
765
|
-readonly [P in keyof T]: T[P];
|
|
797
766
|
};
|
|
798
|
-
export
|
|
799
|
-
export
|
|
767
|
+
export type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
768
|
+
export type typecast<A, T> = A extends T ? A : never;
|
|
800
769
|
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
801
770
|
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
802
771
|
export declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
|
|
@@ -814,7 +783,7 @@ export interface ZodNativeEnumDef<T extends EnumLike = EnumLike> extends ZodType
|
|
|
814
783
|
values: T;
|
|
815
784
|
typeName: ZodFirstPartyTypeKind.ZodNativeEnum;
|
|
816
785
|
}
|
|
817
|
-
export
|
|
786
|
+
export type EnumLike = {
|
|
818
787
|
[k: string]: string | number;
|
|
819
788
|
[nu: number]: string;
|
|
820
789
|
};
|
|
@@ -833,21 +802,21 @@ export declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T[
|
|
|
833
802
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
834
803
|
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
|
|
835
804
|
}
|
|
836
|
-
export
|
|
837
|
-
export
|
|
838
|
-
export
|
|
805
|
+
export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
806
|
+
export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
807
|
+
export type RefinementEffect<T> = {
|
|
839
808
|
type: "refinement";
|
|
840
809
|
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
841
810
|
};
|
|
842
|
-
export
|
|
811
|
+
export type TransformEffect<T> = {
|
|
843
812
|
type: "transform";
|
|
844
813
|
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
845
814
|
};
|
|
846
|
-
export
|
|
815
|
+
export type PreprocessEffect<T> = {
|
|
847
816
|
type: "preprocess";
|
|
848
817
|
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
849
818
|
};
|
|
850
|
-
export
|
|
819
|
+
export type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
851
820
|
export interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
852
821
|
schema: T;
|
|
853
822
|
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
@@ -857,7 +826,7 @@ export declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input
|
|
|
857
826
|
innerType(): T;
|
|
858
827
|
sourceType(): T;
|
|
859
828
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
860
|
-
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]
|
|
829
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
861
830
|
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
862
831
|
}
|
|
863
832
|
export { ZodEffects as ZodTransformer };
|
|
@@ -865,7 +834,7 @@ export interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTy
|
|
|
865
834
|
innerType: T;
|
|
866
835
|
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
867
836
|
}
|
|
868
|
-
export
|
|
837
|
+
export type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
869
838
|
export declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
870
839
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
871
840
|
unwrap(): T;
|
|
@@ -875,7 +844,7 @@ export interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTy
|
|
|
875
844
|
innerType: T;
|
|
876
845
|
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
877
846
|
}
|
|
878
|
-
export
|
|
847
|
+
export type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
879
848
|
export declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
880
849
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
881
850
|
unwrap(): T;
|
|
@@ -932,7 +901,7 @@ export interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
|
932
901
|
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
933
902
|
}
|
|
934
903
|
export declare const BRAND: unique symbol;
|
|
935
|
-
export
|
|
904
|
+
export type BRAND<T extends string | number | symbol> = {
|
|
936
905
|
[BRAND]: {
|
|
937
906
|
[k in T]: true;
|
|
938
907
|
};
|
|
@@ -950,10 +919,10 @@ export declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> ext
|
|
|
950
919
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
951
920
|
static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
|
|
952
921
|
}
|
|
953
|
-
|
|
922
|
+
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
954
923
|
readonly [Symbol.toStringTag]: string;
|
|
955
924
|
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
956
|
-
|
|
925
|
+
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
957
926
|
export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
958
927
|
innerType: T;
|
|
959
928
|
typeName: ZodFirstPartyTypeKind.ZodReadonly;
|
|
@@ -963,10 +932,10 @@ export declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReado
|
|
|
963
932
|
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodReadonly<T_1>;
|
|
964
933
|
unwrap(): T;
|
|
965
934
|
}
|
|
966
|
-
|
|
935
|
+
type CustomParams = CustomErrorParams & {
|
|
967
936
|
fatal?: boolean;
|
|
968
937
|
};
|
|
969
|
-
export declare function custom<T>(check?: (data: any) => any,
|
|
938
|
+
export declare function custom<T>(check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams),
|
|
970
939
|
/**
|
|
971
940
|
* @deprecated
|
|
972
941
|
*
|
|
@@ -980,7 +949,7 @@ export declare function custom<T>(check?: (data: any) => any, params?: string |
|
|
|
980
949
|
fatal?: boolean): ZodType<T, ZodTypeDef, T>;
|
|
981
950
|
export { ZodType as Schema, ZodType as ZodSchema };
|
|
982
951
|
export declare const late: {
|
|
983
|
-
object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip"
|
|
952
|
+
object: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip">;
|
|
984
953
|
};
|
|
985
954
|
export declare enum ZodFirstPartyTypeKind {
|
|
986
955
|
ZodString = "ZodString",
|
|
@@ -1020,57 +989,27 @@ export declare enum ZodFirstPartyTypeKind {
|
|
|
1020
989
|
ZodPipeline = "ZodPipeline",
|
|
1021
990
|
ZodReadonly = "ZodReadonly"
|
|
1022
991
|
}
|
|
1023
|
-
export
|
|
992
|
+
export type ZodFirstPartySchemaTypes = ZodString | ZodNumber | ZodNaN | ZodBigInt | ZodBoolean | ZodDate | ZodUndefined | ZodNull | ZodAny | ZodUnknown | ZodNever | ZodVoid | ZodArray<any, any> | ZodObject<any, any, any> | ZodUnion<any> | ZodDiscriminatedUnion<any, any> | ZodIntersection<any, any> | ZodTuple<any, any> | ZodRecord<any, any> | ZodMap<any> | ZodSet<any> | ZodFunction<any, any> | ZodLazy<any> | ZodLiteral<any> | ZodEnum<any> | ZodEffects<any, any, any> | ZodNativeEnum<any> | ZodOptional<any> | ZodNullable<any> | ZodDefault<any> | ZodCatch<any> | ZodPromise<any> | ZodBranded<any, any> | ZodPipeline<any, any> | ZodReadonly<any> | ZodSymbol;
|
|
1024
993
|
declare abstract class Class {
|
|
1025
994
|
constructor(..._: any[]);
|
|
1026
995
|
}
|
|
1027
996
|
declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => ZodType<InstanceType<T>, ZodTypeDef, InstanceType<T>>;
|
|
1028
|
-
declare const stringType: (params?:
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
} & {
|
|
1035
|
-
coerce?: true | undefined;
|
|
1036
|
-
}) | undefined) => ZodString;
|
|
1037
|
-
declare const numberType: (params?: ({
|
|
1038
|
-
errorMap?: ZodErrorMap | undefined;
|
|
1039
|
-
invalid_type_error?: string | undefined;
|
|
1040
|
-
required_error?: string | undefined;
|
|
1041
|
-
message?: string | undefined;
|
|
1042
|
-
description?: string | undefined;
|
|
1043
|
-
} & {
|
|
1044
|
-
coerce?: boolean | undefined;
|
|
1045
|
-
}) | undefined) => ZodNumber;
|
|
997
|
+
declare const stringType: (params?: RawCreateParams & {
|
|
998
|
+
coerce?: true;
|
|
999
|
+
}) => ZodString;
|
|
1000
|
+
declare const numberType: (params?: RawCreateParams & {
|
|
1001
|
+
coerce?: boolean;
|
|
1002
|
+
}) => ZodNumber;
|
|
1046
1003
|
declare const nanType: (params?: RawCreateParams) => ZodNaN;
|
|
1047
|
-
declare const bigIntType: (params?:
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
coerce?: boolean
|
|
1055
|
-
})
|
|
1056
|
-
declare const booleanType: (params?: ({
|
|
1057
|
-
errorMap?: ZodErrorMap | undefined;
|
|
1058
|
-
invalid_type_error?: string | undefined;
|
|
1059
|
-
required_error?: string | undefined;
|
|
1060
|
-
message?: string | undefined;
|
|
1061
|
-
description?: string | undefined;
|
|
1062
|
-
} & {
|
|
1063
|
-
coerce?: boolean | undefined;
|
|
1064
|
-
}) | undefined) => ZodBoolean;
|
|
1065
|
-
declare const dateType: (params?: ({
|
|
1066
|
-
errorMap?: ZodErrorMap | undefined;
|
|
1067
|
-
invalid_type_error?: string | undefined;
|
|
1068
|
-
required_error?: string | undefined;
|
|
1069
|
-
message?: string | undefined;
|
|
1070
|
-
description?: string | undefined;
|
|
1071
|
-
} & {
|
|
1072
|
-
coerce?: boolean | undefined;
|
|
1073
|
-
}) | undefined) => ZodDate;
|
|
1004
|
+
declare const bigIntType: (params?: RawCreateParams & {
|
|
1005
|
+
coerce?: boolean;
|
|
1006
|
+
}) => ZodBigInt;
|
|
1007
|
+
declare const booleanType: (params?: RawCreateParams & {
|
|
1008
|
+
coerce?: boolean;
|
|
1009
|
+
}) => ZodBoolean;
|
|
1010
|
+
declare const dateType: (params?: RawCreateParams & {
|
|
1011
|
+
coerce?: boolean;
|
|
1012
|
+
}) => ZodDate;
|
|
1074
1013
|
declare const symbolType: (params?: RawCreateParams) => ZodSymbol;
|
|
1075
1014
|
declare const undefinedType: (params?: RawCreateParams) => ZodUndefined;
|
|
1076
1015
|
declare const nullType: (params?: RawCreateParams) => ZodNull;
|
|
@@ -1078,9 +1017,9 @@ declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
|
1078
1017
|
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
1079
1018
|
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
1080
1019
|
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
1081
|
-
declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T
|
|
1082
|
-
declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny,
|
|
1083
|
-
declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict"
|
|
1020
|
+
declare const arrayType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T>;
|
|
1021
|
+
declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, objectOutputType<T, ZodTypeAny, "strip">, objectInputType<T, ZodTypeAny, "strip">>;
|
|
1022
|
+
declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict">;
|
|
1084
1023
|
declare const unionType: <T extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T, params?: RawCreateParams) => ZodUnion<T>;
|
|
1085
1024
|
declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
|
|
1086
1025
|
declare const intersectionType: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
|
|
@@ -1094,7 +1033,7 @@ declare const literalType: <T extends Primitive>(value: T, params?: RawCreatePar
|
|
|
1094
1033
|
declare const enumType: typeof createZodEnum;
|
|
1095
1034
|
declare const nativeEnumType: <T extends EnumLike>(values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
|
|
1096
1035
|
declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>;
|
|
1097
|
-
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]
|
|
1036
|
+
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1098
1037
|
declare const optionalType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>;
|
|
1099
1038
|
declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>;
|
|
1100
1039
|
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
@@ -1103,51 +1042,21 @@ declare const ostring: () => ZodOptional<ZodString>;
|
|
|
1103
1042
|
declare const onumber: () => ZodOptional<ZodNumber>;
|
|
1104
1043
|
declare const oboolean: () => ZodOptional<ZodBoolean>;
|
|
1105
1044
|
export declare const coerce: {
|
|
1106
|
-
string: (params?:
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
coerce?:
|
|
1114
|
-
})
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
} & {
|
|
1122
|
-
coerce?: boolean | undefined;
|
|
1123
|
-
}) | undefined) => ZodNumber;
|
|
1124
|
-
boolean: (params?: ({
|
|
1125
|
-
errorMap?: ZodErrorMap | undefined;
|
|
1126
|
-
invalid_type_error?: string | undefined;
|
|
1127
|
-
required_error?: string | undefined;
|
|
1128
|
-
message?: string | undefined;
|
|
1129
|
-
description?: string | undefined;
|
|
1130
|
-
} & {
|
|
1131
|
-
coerce?: boolean | undefined;
|
|
1132
|
-
}) | undefined) => ZodBoolean;
|
|
1133
|
-
bigint: (params?: ({
|
|
1134
|
-
errorMap?: ZodErrorMap | undefined;
|
|
1135
|
-
invalid_type_error?: string | undefined;
|
|
1136
|
-
required_error?: string | undefined;
|
|
1137
|
-
message?: string | undefined;
|
|
1138
|
-
description?: string | undefined;
|
|
1139
|
-
} & {
|
|
1140
|
-
coerce?: boolean | undefined;
|
|
1141
|
-
}) | undefined) => ZodBigInt;
|
|
1142
|
-
date: (params?: ({
|
|
1143
|
-
errorMap?: ZodErrorMap | undefined;
|
|
1144
|
-
invalid_type_error?: string | undefined;
|
|
1145
|
-
required_error?: string | undefined;
|
|
1146
|
-
message?: string | undefined;
|
|
1147
|
-
description?: string | undefined;
|
|
1148
|
-
} & {
|
|
1149
|
-
coerce?: boolean | undefined;
|
|
1150
|
-
}) | undefined) => ZodDate;
|
|
1045
|
+
string: (params?: RawCreateParams & {
|
|
1046
|
+
coerce?: true;
|
|
1047
|
+
}) => ZodString;
|
|
1048
|
+
number: (params?: RawCreateParams & {
|
|
1049
|
+
coerce?: boolean;
|
|
1050
|
+
}) => ZodNumber;
|
|
1051
|
+
boolean: (params?: RawCreateParams & {
|
|
1052
|
+
coerce?: boolean;
|
|
1053
|
+
}) => ZodBoolean;
|
|
1054
|
+
bigint: (params?: RawCreateParams & {
|
|
1055
|
+
coerce?: boolean;
|
|
1056
|
+
}) => ZodBigInt;
|
|
1057
|
+
date: (params?: RawCreateParams & {
|
|
1058
|
+
coerce?: boolean;
|
|
1059
|
+
}) => ZodDate;
|
|
1151
1060
|
};
|
|
1152
1061
|
export { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };
|
|
1153
1062
|
export declare const NEVER: never;
|