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
|
@@ -26,18 +26,13 @@ export interface $ZodTypeDef {
|
|
|
26
26
|
error?: errors.$ZodErrorMap<never> | undefined;
|
|
27
27
|
checks?: checks.$ZodCheck<never>[];
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
|
|
29
|
+
export interface _$ZodTypeInternals {
|
|
31
30
|
/** The `@zod/core` version of this schema */
|
|
32
31
|
version: typeof version;
|
|
33
32
|
/** Schema definition. */
|
|
34
33
|
def: $ZodTypeDef;
|
|
35
34
|
/** @internal Randomly generated ID for this schema. */
|
|
36
35
|
id: string;
|
|
37
|
-
/** @internal The inferred output type */
|
|
38
|
-
output: O;
|
|
39
|
-
/** @internal The inferred input type */
|
|
40
|
-
input: I;
|
|
41
36
|
/** @internal List of deferred initializers. */
|
|
42
37
|
deferred: util.AnyFunc[] | undefined;
|
|
43
38
|
/** @internal Parses input and runs all checks (refinements). */
|
|
@@ -75,9 +70,19 @@ export interface $ZodTypeInternals<out O = unknown, out I = unknown> {
|
|
|
75
70
|
/** @internal The parent of this schema. Only set during certain clone operations. */
|
|
76
71
|
parent?: $ZodType | undefined;
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
export interface $
|
|
80
|
-
|
|
73
|
+
/** @internal */
|
|
74
|
+
export interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
|
|
75
|
+
/** @internal The inferred output type */
|
|
76
|
+
output: O;
|
|
77
|
+
/** @internal The inferred input type */
|
|
78
|
+
input: I;
|
|
79
|
+
}
|
|
80
|
+
export type $ZodStandardSchema<T> = StandardSchemaV1.Props<core.input<T>, core.output<T>>;
|
|
81
|
+
export interface _$ZodType<T extends _$ZodTypeInternals = _$ZodTypeInternals> {
|
|
82
|
+
_zod: T;
|
|
83
|
+
}
|
|
84
|
+
export type SomeType = _$ZodType;
|
|
85
|
+
export interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> extends _$ZodType<Internals> {
|
|
81
86
|
"~standard": $ZodStandardSchema<this>;
|
|
82
87
|
}
|
|
83
88
|
export declare const $ZodType: core.$constructor<$ZodType>;
|
|
@@ -496,15 +501,15 @@ export interface $ZodDate<T = unknown> extends $ZodType {
|
|
|
496
501
|
_zod: $ZodDateInternals<T>;
|
|
497
502
|
}
|
|
498
503
|
export declare const $ZodDate: core.$constructor<$ZodDate>;
|
|
499
|
-
export interface $ZodArrayDef<T extends
|
|
504
|
+
export interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
500
505
|
type: "array";
|
|
501
506
|
element: T;
|
|
502
507
|
}
|
|
503
|
-
export interface $ZodArrayInternals<T extends
|
|
508
|
+
export interface $ZodArrayInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>[], core.input<T>[]> {
|
|
504
509
|
def: $ZodArrayDef<T>;
|
|
505
510
|
isst: errors.$ZodIssueInvalidType;
|
|
506
511
|
}
|
|
507
|
-
export interface $ZodArray<T extends
|
|
512
|
+
export interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType {
|
|
508
513
|
_zod: $ZodArrayInternals<T>;
|
|
509
514
|
}
|
|
510
515
|
export declare const $ZodArray: core.$constructor<$ZodArray>;
|
|
@@ -518,13 +523,13 @@ export interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $Zod
|
|
|
518
523
|
}
|
|
519
524
|
export interface $ZodObjectInternals<
|
|
520
525
|
/** @ts-ignore Cast variance */
|
|
521
|
-
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodTypeInternals
|
|
526
|
+
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
|
|
522
527
|
def: $ZodObjectDef<Shape>;
|
|
523
528
|
config: Config;
|
|
524
529
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueUnrecognizedKeys;
|
|
525
530
|
propValues: util.PropValues;
|
|
526
|
-
|
|
527
|
-
|
|
531
|
+
output: $InferObjectOutput<Shape, Config["out"]>;
|
|
532
|
+
input: $InferObjectInput<Shape, Config["in"]>;
|
|
528
533
|
}
|
|
529
534
|
export type $ZodLooseShape = Record<string, any>;
|
|
530
535
|
type OptionalOutSchema = {
|
|
@@ -569,7 +574,7 @@ export type $strip = {
|
|
|
569
574
|
out: {};
|
|
570
575
|
in: {};
|
|
571
576
|
};
|
|
572
|
-
export type $catchall<T extends $ZodType> = {
|
|
577
|
+
export type $catchall<T extends _$ZodType> = {
|
|
573
578
|
out: {
|
|
574
579
|
[k: string]: core.output<T>;
|
|
575
580
|
};
|
|
@@ -579,123 +584,123 @@ export type $catchall<T extends $ZodType> = {
|
|
|
579
584
|
};
|
|
580
585
|
export interface $ZodObject<
|
|
581
586
|
/** @ts-ignore Cast variance */
|
|
582
|
-
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType {
|
|
583
|
-
|
|
587
|
+
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
|
|
588
|
+
"~standard": $ZodStandardSchema<this>;
|
|
584
589
|
}
|
|
585
590
|
export declare const $ZodObject: core.$constructor<$ZodObject>;
|
|
586
|
-
export type $InferUnionOutput<T extends
|
|
587
|
-
export type $InferUnionInput<T extends
|
|
588
|
-
export interface $ZodUnionDef<Options extends readonly
|
|
591
|
+
export type $InferUnionOutput<T extends SomeType> = T extends any ? core.output<T> : never;
|
|
592
|
+
export type $InferUnionInput<T extends SomeType> = T extends any ? core.input<T> : never;
|
|
593
|
+
export interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
|
|
589
594
|
type: "union";
|
|
590
595
|
options: Options;
|
|
591
596
|
}
|
|
592
|
-
export interface $ZodUnionInternals<T extends readonly
|
|
597
|
+
export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeInternals<$InferUnionOutput<T[number]>, $InferUnionInput<T[number]>> {
|
|
593
598
|
def: $ZodUnionDef<T>;
|
|
594
599
|
isst: errors.$ZodIssueInvalidUnion;
|
|
595
600
|
pattern: T[number]["_zod"]["pattern"];
|
|
596
601
|
}
|
|
597
|
-
export interface $ZodUnion<T extends readonly
|
|
602
|
+
export interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
|
|
598
603
|
_zod: $ZodUnionInternals<T>;
|
|
599
604
|
}
|
|
600
605
|
export declare const $ZodUnion: core.$constructor<$ZodUnion>;
|
|
601
|
-
export interface $ZodDiscriminatedUnionDef<Options extends readonly
|
|
606
|
+
export interface $ZodDiscriminatedUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodUnionDef<Options> {
|
|
602
607
|
discriminator: string;
|
|
603
608
|
unionFallback?: boolean;
|
|
604
609
|
}
|
|
605
|
-
export interface $ZodDiscriminatedUnionInternals<Options extends readonly
|
|
610
|
+
export interface $ZodDiscriminatedUnionInternals<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodUnionInternals<Options> {
|
|
606
611
|
def: $ZodDiscriminatedUnionDef<Options>;
|
|
607
612
|
propValues: util.PropValues;
|
|
608
613
|
}
|
|
609
|
-
export interface $ZodDiscriminatedUnion<T extends readonly
|
|
614
|
+
export interface $ZodDiscriminatedUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType {
|
|
610
615
|
_zod: $ZodDiscriminatedUnionInternals<T>;
|
|
611
616
|
}
|
|
612
617
|
export declare const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion>;
|
|
613
|
-
export interface $ZodIntersectionDef extends $ZodTypeDef {
|
|
618
|
+
export interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
614
619
|
type: "intersection";
|
|
615
|
-
left:
|
|
616
|
-
right:
|
|
620
|
+
left: Left;
|
|
621
|
+
right: Right;
|
|
617
622
|
}
|
|
618
|
-
export interface $ZodIntersectionInternals<A extends
|
|
619
|
-
def: $ZodIntersectionDef
|
|
623
|
+
export interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<A> & core.output<B>, core.input<A> & core.input<B>> {
|
|
624
|
+
def: $ZodIntersectionDef<A, B>;
|
|
620
625
|
isst: never;
|
|
621
626
|
}
|
|
622
|
-
export interface $ZodIntersection<A extends
|
|
627
|
+
export interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
|
|
623
628
|
_zod: $ZodIntersectionInternals<A, B>;
|
|
624
629
|
}
|
|
625
630
|
export declare const $ZodIntersection: core.$constructor<$ZodIntersection>;
|
|
626
|
-
export interface $ZodTupleDef<T extends util.TupleItems =
|
|
631
|
+
export interface $ZodTupleDef<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeDef {
|
|
627
632
|
type: "tuple";
|
|
628
633
|
items: T;
|
|
629
634
|
rest: Rest;
|
|
630
635
|
}
|
|
631
|
-
export type $InferTupleInputType<T extends util.TupleItems, Rest extends
|
|
636
|
+
export type $InferTupleInputType<T extends util.TupleItems, Rest extends SomeType | null> = [
|
|
632
637
|
...TupleInputTypeWithOptionals<T>,
|
|
633
|
-
...(Rest extends
|
|
638
|
+
...(Rest extends SomeType ? core.input<Rest>[] : [])
|
|
634
639
|
];
|
|
635
640
|
type TupleInputTypeNoOptionals<T extends util.TupleItems> = {
|
|
636
641
|
[k in keyof T]: core.input<T[k]>;
|
|
637
642
|
};
|
|
638
643
|
type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
|
|
639
|
-
...infer Prefix extends
|
|
640
|
-
infer Tail extends
|
|
641
|
-
] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, Tail
|
|
642
|
-
export type $InferTupleOutputType<T extends util.TupleItems, Rest extends
|
|
644
|
+
...infer Prefix extends SomeType[],
|
|
645
|
+
infer Tail extends SomeType
|
|
646
|
+
] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
|
|
647
|
+
export type $InferTupleOutputType<T extends util.TupleItems, Rest extends SomeType | null> = [
|
|
643
648
|
...TupleOutputTypeWithOptionals<T>,
|
|
644
|
-
...(Rest extends
|
|
649
|
+
...(Rest extends SomeType ? core.output<Rest>[] : [])
|
|
645
650
|
];
|
|
646
651
|
type TupleOutputTypeNoOptionals<T extends util.TupleItems> = {
|
|
647
652
|
[k in keyof T]: core.output<T[k]>;
|
|
648
653
|
};
|
|
649
654
|
type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonly [
|
|
650
|
-
...infer Prefix extends
|
|
651
|
-
infer Tail extends
|
|
655
|
+
...infer Prefix extends SomeType[],
|
|
656
|
+
infer Tail extends SomeType
|
|
652
657
|
] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
653
|
-
export interface $ZodTupleInternals<T extends util.TupleItems =
|
|
658
|
+
export interface $ZodTupleInternals<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>> {
|
|
654
659
|
def: $ZodTupleDef<T, Rest>;
|
|
655
660
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
|
|
656
661
|
}
|
|
657
|
-
export interface $ZodTuple<T extends util.TupleItems =
|
|
662
|
+
export interface $ZodTuple<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodType {
|
|
658
663
|
_zod: $ZodTupleInternals<T, Rest>;
|
|
659
664
|
}
|
|
660
665
|
export declare const $ZodTuple: core.$constructor<$ZodTuple>;
|
|
661
666
|
export type $ZodRecordKey = $ZodType<string | number | symbol, string | number | symbol>;
|
|
662
|
-
export interface $ZodRecordDef extends $ZodTypeDef {
|
|
667
|
+
export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
663
668
|
type: "record";
|
|
664
|
-
keyType:
|
|
665
|
-
valueType:
|
|
669
|
+
keyType: Key;
|
|
670
|
+
valueType: Value;
|
|
666
671
|
}
|
|
667
|
-
export type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends
|
|
668
|
-
export type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends
|
|
669
|
-
export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends
|
|
670
|
-
def: $ZodRecordDef
|
|
672
|
+
export type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = undefined extends Key["_zod"]["values"] ? string extends core.output<Key> ? Record<core.output<Key>, core.output<Value>> : number extends core.output<Key> ? Record<core.output<Key>, core.output<Value>> : symbol extends core.output<Key> ? Record<core.output<Key>, core.output<Value>> : Partial<Record<core.output<Key>, core.output<Value>>> : Record<core.output<Key>, core.output<Value>>;
|
|
673
|
+
export type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = undefined extends Key["_zod"]["values"] ? string extends core.input<Key> ? Record<core.input<Key>, core.input<Value>> : number extends core.input<Key> ? Record<core.input<Key>, core.input<Value>> : symbol extends core.input<Key> ? Record<core.input<Key>, core.input<Value>> : Partial<Record<core.input<Key>, core.input<Value>>> : Record<core.input<Key>, core.input<Value>>;
|
|
674
|
+
export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
|
|
675
|
+
def: $ZodRecordDef<Key, Value>;
|
|
671
676
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
|
|
672
677
|
}
|
|
673
|
-
export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends
|
|
678
|
+
export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodType {
|
|
674
679
|
_zod: $ZodRecordInternals<Key, Value>;
|
|
675
680
|
}
|
|
676
681
|
export declare const $ZodRecord: core.$constructor<$ZodRecord>;
|
|
677
|
-
export interface $ZodMapDef extends $ZodTypeDef {
|
|
682
|
+
export interface $ZodMapDef<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
678
683
|
type: "map";
|
|
679
|
-
keyType:
|
|
680
|
-
valueType:
|
|
684
|
+
keyType: Key;
|
|
685
|
+
valueType: Value;
|
|
681
686
|
}
|
|
682
|
-
export interface $ZodMapInternals<Key extends
|
|
683
|
-
def: $ZodMapDef
|
|
687
|
+
export interface $ZodMapInternals<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeInternals<Map<core.output<Key>, core.output<Value>>, Map<core.input<Key>, core.input<Value>>> {
|
|
688
|
+
def: $ZodMapDef<Key, Value>;
|
|
684
689
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueInvalidKey | errors.$ZodIssueInvalidElement<unknown>;
|
|
685
690
|
}
|
|
686
|
-
export interface $ZodMap<Key extends
|
|
691
|
+
export interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodType {
|
|
687
692
|
_zod: $ZodMapInternals<Key, Value>;
|
|
688
693
|
}
|
|
689
694
|
export declare const $ZodMap: core.$constructor<$ZodMap>;
|
|
690
|
-
export interface $ZodSetDef extends $ZodTypeDef {
|
|
695
|
+
export interface $ZodSetDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
691
696
|
type: "set";
|
|
692
|
-
valueType:
|
|
697
|
+
valueType: T;
|
|
693
698
|
}
|
|
694
|
-
export interface $ZodSetInternals<T extends
|
|
695
|
-
def: $ZodSetDef
|
|
699
|
+
export interface $ZodSetInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Set<core.output<T>>, Set<core.input<T>>> {
|
|
700
|
+
def: $ZodSetDef<T>;
|
|
696
701
|
isst: errors.$ZodIssueInvalidType;
|
|
697
702
|
}
|
|
698
|
-
export interface $ZodSet<T extends
|
|
703
|
+
export interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
|
|
699
704
|
_zod: $ZodSetInternals<T>;
|
|
700
705
|
}
|
|
701
706
|
export declare const $ZodSet: core.$constructor<$ZodSet>;
|
|
@@ -765,11 +770,11 @@ export interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
|
|
|
765
770
|
_zod: $ZodTransformInternals<O, I>;
|
|
766
771
|
}
|
|
767
772
|
export declare const $ZodTransform: core.$constructor<$ZodTransform>;
|
|
768
|
-
export interface $ZodOptionalDef<T extends
|
|
773
|
+
export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
769
774
|
type: "optional";
|
|
770
775
|
innerType: T;
|
|
771
776
|
}
|
|
772
|
-
export interface $ZodOptionalInternals<T extends
|
|
777
|
+
export interface $ZodOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
|
|
773
778
|
def: $ZodOptionalDef<T>;
|
|
774
779
|
optin: "optional";
|
|
775
780
|
optout: "optional";
|
|
@@ -777,15 +782,15 @@ export interface $ZodOptionalInternals<T extends $ZodType = $ZodType> extends $Z
|
|
|
777
782
|
values: T["_zod"]["values"];
|
|
778
783
|
pattern: T["_zod"]["pattern"];
|
|
779
784
|
}
|
|
780
|
-
export interface $ZodOptional<T extends
|
|
785
|
+
export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
|
|
781
786
|
_zod: $ZodOptionalInternals<T>;
|
|
782
787
|
}
|
|
783
788
|
export declare const $ZodOptional: core.$constructor<$ZodOptional>;
|
|
784
|
-
export interface $ZodNullableDef<T extends
|
|
789
|
+
export interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
785
790
|
type: "nullable";
|
|
786
791
|
innerType: T;
|
|
787
792
|
}
|
|
788
|
-
export interface $ZodNullableInternals<T extends
|
|
793
|
+
export interface $ZodNullableInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T> | null, core.input<T> | null> {
|
|
789
794
|
def: $ZodNullableDef<T>;
|
|
790
795
|
optin: T["_zod"]["optin"];
|
|
791
796
|
optout: T["_zod"]["optout"];
|
|
@@ -793,64 +798,64 @@ export interface $ZodNullableInternals<T extends $ZodType = $ZodType> extends $Z
|
|
|
793
798
|
values: T["_zod"]["values"];
|
|
794
799
|
pattern: T["_zod"]["pattern"];
|
|
795
800
|
}
|
|
796
|
-
export interface $ZodNullable<T extends
|
|
801
|
+
export interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
|
|
797
802
|
_zod: $ZodNullableInternals<T>;
|
|
798
803
|
}
|
|
799
804
|
export declare const $ZodNullable: core.$constructor<$ZodNullable>;
|
|
800
|
-
export interface $ZodDefaultDef<T extends
|
|
805
|
+
export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
801
806
|
type: "default";
|
|
802
807
|
innerType: T;
|
|
803
808
|
/** The default value. May be a getter. */
|
|
804
809
|
defaultValue: util.NoUndefined<core.output<T>>;
|
|
805
810
|
}
|
|
806
|
-
export interface $ZodDefaultInternals<T extends
|
|
811
|
+
export interface $ZodDefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
|
|
807
812
|
def: $ZodDefaultDef<T>;
|
|
808
813
|
optin: "optional";
|
|
809
814
|
isst: never;
|
|
810
815
|
values: T["_zod"]["values"];
|
|
811
816
|
}
|
|
812
|
-
export interface $ZodDefault<T extends
|
|
817
|
+
export interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
|
|
813
818
|
_zod: $ZodDefaultInternals<T>;
|
|
814
819
|
}
|
|
815
820
|
export declare const $ZodDefault: core.$constructor<$ZodDefault>;
|
|
816
|
-
export interface $ZodPrefaultDef<T extends
|
|
821
|
+
export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
817
822
|
type: "prefault";
|
|
818
823
|
innerType: T;
|
|
819
824
|
/** The default value. May be a getter. */
|
|
820
825
|
defaultValue: core.input<T>;
|
|
821
826
|
}
|
|
822
|
-
export interface $ZodPrefaultInternals<T extends
|
|
827
|
+
export interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
|
|
823
828
|
def: $ZodPrefaultDef<T>;
|
|
824
829
|
optin: "optional";
|
|
825
830
|
isst: never;
|
|
826
831
|
values: T["_zod"]["values"];
|
|
827
832
|
}
|
|
828
|
-
export interface $ZodPrefault<T extends
|
|
833
|
+
export interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
|
|
829
834
|
_zod: $ZodPrefaultInternals<T>;
|
|
830
835
|
}
|
|
831
836
|
export declare const $ZodPrefault: core.$constructor<$ZodPrefault>;
|
|
832
|
-
export interface $ZodNonOptionalDef<T extends
|
|
837
|
+
export interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
833
838
|
type: "nonoptional";
|
|
834
839
|
innerType: T;
|
|
835
840
|
}
|
|
836
|
-
export interface $ZodNonOptionalInternals<T extends
|
|
841
|
+
export interface $ZodNonOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, util.NoUndefined<core.input<T>>> {
|
|
837
842
|
def: $ZodNonOptionalDef<T>;
|
|
838
843
|
isst: errors.$ZodIssueInvalidType;
|
|
839
844
|
values: T["_zod"]["values"];
|
|
840
845
|
}
|
|
841
|
-
export interface $ZodNonOptional<T extends
|
|
846
|
+
export interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
|
|
842
847
|
_zod: $ZodNonOptionalInternals<T>;
|
|
843
848
|
}
|
|
844
849
|
export declare const $ZodNonOptional: core.$constructor<$ZodNonOptional>;
|
|
845
|
-
export interface $ZodSuccessDef extends $ZodTypeDef {
|
|
850
|
+
export interface $ZodSuccessDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
846
851
|
type: "success";
|
|
847
|
-
innerType:
|
|
852
|
+
innerType: T;
|
|
848
853
|
}
|
|
849
|
-
export interface $ZodSuccessInternals<T extends
|
|
850
|
-
def: $ZodSuccessDef
|
|
854
|
+
export interface $ZodSuccessInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<boolean, core.input<T>> {
|
|
855
|
+
def: $ZodSuccessDef<T>;
|
|
851
856
|
isst: never;
|
|
852
857
|
}
|
|
853
|
-
export interface $ZodSuccess<T extends
|
|
858
|
+
export interface $ZodSuccess<T extends SomeType = $ZodType> extends $ZodType {
|
|
854
859
|
_zod: $ZodSuccessInternals<T>;
|
|
855
860
|
}
|
|
856
861
|
export declare const $ZodSuccess: core.$constructor<$ZodSuccess>;
|
|
@@ -862,19 +867,19 @@ export interface $ZodCatchCtx extends ParsePayload {
|
|
|
862
867
|
/** @deprecated Use `ctx.value` */
|
|
863
868
|
input: unknown;
|
|
864
869
|
}
|
|
865
|
-
export interface $ZodCatchDef extends $ZodTypeDef {
|
|
870
|
+
export interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
866
871
|
type: "catch";
|
|
867
|
-
innerType:
|
|
872
|
+
innerType: T;
|
|
868
873
|
catchValue: (ctx: $ZodCatchCtx) => unknown;
|
|
869
874
|
}
|
|
870
|
-
export interface $ZodCatchInternals<T extends
|
|
871
|
-
def: $ZodCatchDef
|
|
875
|
+
export interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T> | util.Whatever> {
|
|
876
|
+
def: $ZodCatchDef<T>;
|
|
872
877
|
optin: T["_zod"]["optin"];
|
|
873
878
|
optout: T["_zod"]["optout"];
|
|
874
879
|
isst: never;
|
|
875
880
|
values: T["_zod"]["values"];
|
|
876
881
|
}
|
|
877
|
-
export interface $ZodCatch<T extends
|
|
882
|
+
export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
|
|
878
883
|
_zod: $ZodCatchInternals<T>;
|
|
879
884
|
}
|
|
880
885
|
export declare const $ZodCatch: core.$constructor<$ZodCatch>;
|
|
@@ -889,34 +894,34 @@ export interface $ZodNaN extends $ZodType {
|
|
|
889
894
|
_zod: $ZodNaNInternals;
|
|
890
895
|
}
|
|
891
896
|
export declare const $ZodNaN: core.$constructor<$ZodNaN>;
|
|
892
|
-
export interface $ZodPipeDef<A extends
|
|
897
|
+
export interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
893
898
|
type: "pipe";
|
|
894
899
|
in: A;
|
|
895
900
|
out: B;
|
|
896
901
|
}
|
|
897
|
-
export interface $ZodPipeInternals<A extends
|
|
902
|
+
export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<B>, core.input<A>> {
|
|
898
903
|
def: $ZodPipeDef<A, B>;
|
|
899
904
|
isst: never;
|
|
900
905
|
values: A["_zod"]["values"];
|
|
901
906
|
optin: A["_zod"]["optin"];
|
|
902
907
|
optout: B["_zod"]["optout"];
|
|
903
908
|
}
|
|
904
|
-
export interface $ZodPipe<A extends
|
|
909
|
+
export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
|
|
905
910
|
_zod: $ZodPipeInternals<A, B>;
|
|
906
911
|
}
|
|
907
912
|
export declare const $ZodPipe: core.$constructor<$ZodPipe>;
|
|
908
|
-
export interface $ZodReadonlyDef extends $ZodTypeDef {
|
|
913
|
+
export interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
909
914
|
type: "readonly";
|
|
910
|
-
innerType:
|
|
915
|
+
innerType: T;
|
|
911
916
|
}
|
|
912
|
-
export interface $ZodReadonlyInternals<T extends
|
|
913
|
-
def: $ZodReadonlyDef
|
|
917
|
+
export interface $ZodReadonlyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<util.MakeReadonly<core.output<T>>, util.MakeReadonly<core.input<T>>> {
|
|
918
|
+
def: $ZodReadonlyDef<T>;
|
|
914
919
|
optin: T["_zod"]["optin"];
|
|
915
920
|
optout: T["_zod"]["optout"];
|
|
916
921
|
isst: never;
|
|
917
922
|
propValues: T["_zod"]["propValues"];
|
|
918
923
|
}
|
|
919
|
-
export interface $ZodReadonly<T extends
|
|
924
|
+
export interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
|
|
920
925
|
_zod: $ZodReadonlyInternals<T>;
|
|
921
926
|
}
|
|
922
927
|
export declare const $ZodReadonly: core.$constructor<$ZodReadonly>;
|
|
@@ -941,27 +946,35 @@ interface SchemaPart extends $ZodType {
|
|
|
941
946
|
}
|
|
942
947
|
export type $ZodTemplateLiteralPart = LiteralPart | SchemaPart;
|
|
943
948
|
type UndefinedToEmptyString<T> = T extends undefined ? "" : T;
|
|
944
|
-
type AppendToTemplateLiteral<Template extends string, Suffix extends LiteralPart | $ZodType> = Suffix extends LiteralPart ? `${Template}${UndefinedToEmptyString<Suffix>}` : `${Template}${
|
|
945
|
-
export type
|
|
949
|
+
type AppendToTemplateLiteral<Template extends string, Suffix extends LiteralPart | $ZodType> = Suffix extends LiteralPart ? `${Template}${UndefinedToEmptyString<Suffix>}` : Suffix extends $ZodType ? `${Template}${core.output<Suffix> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}` : never;
|
|
950
|
+
export type ConcatenateTupleOfStrings<T extends string[]> = T extends [
|
|
951
|
+
infer First extends string,
|
|
952
|
+
...infer Rest extends string[]
|
|
953
|
+
] ? Rest extends string[] ? First extends "" ? ConcatenateTupleOfStrings<Rest> : `${First}${ConcatenateTupleOfStrings<Rest>}` : never : "";
|
|
954
|
+
export type ConvertPartsToStringTuple<Parts extends $ZodTemplateLiteralPart[]> = {
|
|
955
|
+
[K in keyof Parts]: Parts[K] extends LiteralPart ? `${UndefinedToEmptyString<Parts[K]>}` : Parts[K] extends $ZodType ? `${core.output<Parts[K]> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}` : never;
|
|
956
|
+
};
|
|
957
|
+
export type ToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = ConcatenateTupleOfStrings<ConvertPartsToStringTuple<Parts>>;
|
|
958
|
+
export type $PartsToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = [] extends Parts ? `` : Parts extends [...infer Rest, infer Last extends $ZodTemplateLiteralPart] ? Rest extends $ZodTemplateLiteralPart[] ? AppendToTemplateLiteral<$PartsToTemplateLiteral<Rest>, Last> : never : never;
|
|
946
959
|
export declare const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral>;
|
|
947
|
-
export interface $ZodPromiseDef extends $ZodTypeDef {
|
|
960
|
+
export interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
948
961
|
type: "promise";
|
|
949
|
-
innerType:
|
|
962
|
+
innerType: T;
|
|
950
963
|
}
|
|
951
|
-
export interface $ZodPromiseInternals<T extends
|
|
952
|
-
def: $ZodPromiseDef
|
|
964
|
+
export interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, util.MaybeAsync<core.input<T>>> {
|
|
965
|
+
def: $ZodPromiseDef<T>;
|
|
953
966
|
isst: never;
|
|
954
967
|
}
|
|
955
|
-
export interface $ZodPromise<T extends
|
|
968
|
+
export interface $ZodPromise<T extends SomeType = $ZodType> extends $ZodType {
|
|
956
969
|
_zod: $ZodPromiseInternals<T>;
|
|
957
970
|
}
|
|
958
971
|
export declare const $ZodPromise: core.$constructor<$ZodPromise>;
|
|
959
|
-
export interface $ZodLazyDef extends $ZodTypeDef {
|
|
972
|
+
export interface $ZodLazyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
960
973
|
type: "lazy";
|
|
961
|
-
getter: () =>
|
|
974
|
+
getter: () => T;
|
|
962
975
|
}
|
|
963
|
-
export interface $ZodLazyInternals<T extends
|
|
964
|
-
def: $ZodLazyDef
|
|
976
|
+
export interface $ZodLazyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<core.output<T>, core.input<T>> {
|
|
977
|
+
def: $ZodLazyDef<T>;
|
|
965
978
|
isst: never;
|
|
966
979
|
/** Auto-cached way to retrieve the inner schema */
|
|
967
980
|
innerType: T;
|
|
@@ -970,7 +983,7 @@ export interface $ZodLazyInternals<T extends $ZodType = $ZodType> extends $ZodTy
|
|
|
970
983
|
optin: T["_zod"]["optin"];
|
|
971
984
|
optout: T["_zod"]["optout"];
|
|
972
985
|
}
|
|
973
|
-
export interface $ZodLazy<T extends
|
|
986
|
+
export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
|
|
974
987
|
_zod: $ZodLazyInternals<T>;
|
|
975
988
|
}
|
|
976
989
|
export declare const $ZodLazy: core.$constructor<$ZodLazy>;
|
|
@@ -59,7 +59,7 @@ export type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A
|
|
|
59
59
|
} & {
|
|
60
60
|
[K in keyof B]: B[K];
|
|
61
61
|
}>;
|
|
62
|
-
export type TupleItems = ReadonlyArray<schemas
|
|
62
|
+
export type TupleItems = ReadonlyArray<schemas.SomeType>;
|
|
63
63
|
export type AnyFunc = (...args: any[]) => any;
|
|
64
64
|
export type IsProp<T, K extends keyof T> = T[K] extends AnyFunc ? never : K;
|
|
65
65
|
export type MaybeAsync<T> = T | Promise<T>;
|
|
@@ -71,7 +71,7 @@ export type ExtractIndexSignature<T> = {
|
|
|
71
71
|
[K in keyof T as string extends K ? K : K extends string ? never : K]: T[K];
|
|
72
72
|
};
|
|
73
73
|
export type Keys<T extends object> = keyof OmitIndexSignature<T>;
|
|
74
|
-
export type SchemaClass<T extends schemas
|
|
74
|
+
export type SchemaClass<T extends schemas.SomeType> = {
|
|
75
75
|
new (def: T["_zod"]["def"]): T;
|
|
76
76
|
};
|
|
77
77
|
export type EnumValue = string | number;
|
|
@@ -105,7 +105,6 @@ export type SafeParseError<T> = {
|
|
|
105
105
|
};
|
|
106
106
|
export type PropValues = Record<string, Set<Primitive>>;
|
|
107
107
|
export type PrimitiveSet = Set<Primitive>;
|
|
108
|
-
export type DiscriminatorMap = Map<Primitive, schemas.$ZodType>;
|
|
109
108
|
export declare function assertEqual<A, B>(val: AssertEqual<A, B>): AssertEqual<A, B>;
|
|
110
109
|
export declare function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<A, B>;
|
|
111
110
|
export declare function assertIs<T>(_arg: T): void;
|