zod 3.25.3 → 3.25.4
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/commonjs/v3/types.d.ts +38 -38
- package/dist/esm/v3/types.d.ts +38 -38
- package/package.json +1 -1
- package/src/v3/types.ts +50 -41
|
@@ -491,7 +491,7 @@ export declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCar
|
|
|
491
491
|
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
492
492
|
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
493
493
|
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
494
|
-
static create: <
|
|
494
|
+
static create: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
495
495
|
}
|
|
496
496
|
export type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
497
497
|
export type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
@@ -584,9 +584,9 @@ export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends Unknow
|
|
|
584
584
|
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
585
585
|
}>, UnknownKeys, Catchall>;
|
|
586
586
|
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
587
|
-
static create: <
|
|
588
|
-
static strictCreate: <
|
|
589
|
-
static lazycreate: <
|
|
587
|
+
static create: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
588
|
+
static strictCreate: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
589
|
+
static lazycreate: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
590
590
|
}
|
|
591
591
|
export type AnyZodObject = ZodObject<any, any, any>;
|
|
592
592
|
export type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
@@ -597,7 +597,7 @@ export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[ZodTypeAny, Z
|
|
|
597
597
|
export declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
598
598
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
599
599
|
get options(): T;
|
|
600
|
-
static create: <
|
|
600
|
+
static create: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
601
601
|
}
|
|
602
602
|
export type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
|
|
603
603
|
[key in Discriminator]: ZodTypeAny;
|
|
@@ -633,7 +633,7 @@ export interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends
|
|
|
633
633
|
}
|
|
634
634
|
export declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
635
635
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
636
|
-
static create: <
|
|
636
|
+
static create: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
637
637
|
}
|
|
638
638
|
export type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
639
639
|
export type AssertArray<T> = T extends any[] ? T : never;
|
|
@@ -655,7 +655,7 @@ export declare class ZodTuple<T extends ZodTupleItems | [] = ZodTupleItems, Rest
|
|
|
655
655
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
656
656
|
get items(): T;
|
|
657
657
|
rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
|
|
658
|
-
static create: <
|
|
658
|
+
static create: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
659
659
|
}
|
|
660
660
|
export interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
661
661
|
valueType: Value;
|
|
@@ -681,7 +681,7 @@ export declare class ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends Z
|
|
|
681
681
|
get keySchema(): Key;
|
|
682
682
|
get valueSchema(): Value;
|
|
683
683
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
684
|
-
static create: <
|
|
684
|
+
static create: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
685
685
|
}
|
|
686
686
|
export interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
687
687
|
valueType: Value;
|
|
@@ -701,7 +701,7 @@ export declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodTy
|
|
|
701
701
|
max(maxSize: number, message?: errorUtil.ErrMessage): this;
|
|
702
702
|
size(size: number, message?: errorUtil.ErrMessage): this;
|
|
703
703
|
nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
|
|
704
|
-
static create: <
|
|
704
|
+
static create: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
705
705
|
}
|
|
706
706
|
export interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
707
707
|
args: Args;
|
|
@@ -731,7 +731,7 @@ export interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDe
|
|
|
731
731
|
export declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
|
|
732
732
|
get schema(): T;
|
|
733
733
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
734
|
-
static create: <
|
|
734
|
+
static create: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
735
735
|
}
|
|
736
736
|
export interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
737
737
|
value: T;
|
|
@@ -740,7 +740,7 @@ export interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
|
740
740
|
export declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
741
741
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
742
742
|
get value(): T;
|
|
743
|
-
static create: <
|
|
743
|
+
static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
744
744
|
}
|
|
745
745
|
export type ArrayKeys = keyof any[];
|
|
746
746
|
export type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
@@ -782,7 +782,7 @@ export declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T
|
|
|
782
782
|
#private;
|
|
783
783
|
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
784
784
|
get enum(): T;
|
|
785
|
-
static create: <
|
|
785
|
+
static create: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
786
786
|
}
|
|
787
787
|
export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
788
788
|
type: T;
|
|
@@ -791,7 +791,7 @@ export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTyp
|
|
|
791
791
|
export declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
792
792
|
unwrap(): T;
|
|
793
793
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
794
|
-
static create: <
|
|
794
|
+
static create: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
795
795
|
}
|
|
796
796
|
export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
797
797
|
export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
@@ -829,7 +829,7 @@ export type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
|
829
829
|
export declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
830
830
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
831
831
|
unwrap(): T;
|
|
832
|
-
static create: <
|
|
832
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
833
833
|
}
|
|
834
834
|
export interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
835
835
|
innerType: T;
|
|
@@ -839,7 +839,7 @@ export type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
|
839
839
|
export declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
840
840
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
841
841
|
unwrap(): T;
|
|
842
|
-
static create: <
|
|
842
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
843
843
|
}
|
|
844
844
|
export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
845
845
|
innerType: T;
|
|
@@ -849,9 +849,9 @@ export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTyp
|
|
|
849
849
|
export declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
850
850
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
851
851
|
removeDefault(): T;
|
|
852
|
-
static create: <
|
|
853
|
-
default:
|
|
854
|
-
}) => ZodDefault<
|
|
852
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
853
|
+
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
854
|
+
}) => ZodDefault<Inner>;
|
|
855
855
|
}
|
|
856
856
|
export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
857
857
|
innerType: T;
|
|
@@ -864,9 +864,9 @@ export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeD
|
|
|
864
864
|
export declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
865
865
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
866
866
|
removeCatch(): T;
|
|
867
|
-
static create: <
|
|
868
|
-
catch:
|
|
869
|
-
}) => ZodCatch<
|
|
867
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
868
|
+
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
869
|
+
}) => ZodCatch<Inner>;
|
|
870
870
|
}
|
|
871
871
|
export interface ZodNaNDef extends ZodTypeDef {
|
|
872
872
|
typeName: ZodFirstPartyTypeKind.ZodNaN;
|
|
@@ -896,7 +896,7 @@ export interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> exte
|
|
|
896
896
|
}
|
|
897
897
|
export declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
898
898
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
899
|
-
static create<
|
|
899
|
+
static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(a: ASchema, b: BSchema): ZodPipeline<ASchema, BSchema>;
|
|
900
900
|
}
|
|
901
901
|
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
902
902
|
readonly [Symbol.toStringTag]: string;
|
|
@@ -908,7 +908,7 @@ export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTy
|
|
|
908
908
|
}
|
|
909
909
|
export declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
910
910
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
911
|
-
static create: <
|
|
911
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodReadonly<Inner>;
|
|
912
912
|
unwrap(): T;
|
|
913
913
|
}
|
|
914
914
|
type CustomParams = CustomErrorParams & {
|
|
@@ -928,7 +928,7 @@ export declare function custom<T>(check?: (data: any) => any, _params?: string |
|
|
|
928
928
|
fatal?: boolean): ZodType<T, ZodTypeDef, T>;
|
|
929
929
|
export { ZodType as Schema, ZodType as ZodSchema };
|
|
930
930
|
export declare const late: {
|
|
931
|
-
object: <
|
|
931
|
+
object: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
932
932
|
};
|
|
933
933
|
export declare enum ZodFirstPartyTypeKind {
|
|
934
934
|
ZodString = "ZodString",
|
|
@@ -996,25 +996,25 @@ declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
|
996
996
|
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
997
997
|
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
998
998
|
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
999
|
-
declare const arrayType: <
|
|
1000
|
-
declare const objectType: <
|
|
1001
|
-
declare const strictObjectType: <
|
|
1002
|
-
declare const unionType: <
|
|
999
|
+
declare const arrayType: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
1000
|
+
declare const objectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
1001
|
+
declare const strictObjectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1002
|
+
declare const unionType: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1003
1003
|
declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
|
|
1004
|
-
declare const intersectionType: <
|
|
1005
|
-
declare const tupleType: <
|
|
1004
|
+
declare const intersectionType: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1005
|
+
declare const tupleType: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1006
1006
|
declare const recordType: typeof ZodRecord.create;
|
|
1007
|
-
declare const mapType: <
|
|
1008
|
-
declare const setType: <
|
|
1007
|
+
declare const mapType: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
1008
|
+
declare const setType: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1009
1009
|
declare const functionType: typeof ZodFunction.create;
|
|
1010
|
-
declare const lazyType: <
|
|
1011
|
-
declare const literalType: <
|
|
1010
|
+
declare const lazyType: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
1011
|
+
declare const literalType: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
1012
1012
|
declare const enumType: typeof createZodEnum;
|
|
1013
|
-
declare const nativeEnumType: <
|
|
1014
|
-
declare const promiseType: <
|
|
1013
|
+
declare const nativeEnumType: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
1014
|
+
declare const promiseType: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1015
1015
|
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1016
|
-
declare const optionalType: <
|
|
1017
|
-
declare const nullableType: <
|
|
1016
|
+
declare const optionalType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
1017
|
+
declare const nullableType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
1018
1018
|
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1019
1019
|
declare const pipelineType: typeof ZodPipeline.create;
|
|
1020
1020
|
declare const ostring: () => ZodOptional<ZodString>;
|
package/dist/esm/v3/types.d.ts
CHANGED
|
@@ -491,7 +491,7 @@ export declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCar
|
|
|
491
491
|
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
492
492
|
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
493
493
|
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
494
|
-
static create: <
|
|
494
|
+
static create: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
495
495
|
}
|
|
496
496
|
export type ZodNonEmptyArray<T extends ZodTypeAny> = ZodArray<T, "atleastone">;
|
|
497
497
|
export type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
@@ -584,9 +584,9 @@ export declare class ZodObject<T extends ZodRawShape, UnknownKeys extends Unknow
|
|
|
584
584
|
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
585
585
|
}>, UnknownKeys, Catchall>;
|
|
586
586
|
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
587
|
-
static create: <
|
|
588
|
-
static strictCreate: <
|
|
589
|
-
static lazycreate: <
|
|
587
|
+
static create: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
588
|
+
static strictCreate: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
589
|
+
static lazycreate: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
590
590
|
}
|
|
591
591
|
export type AnyZodObject = ZodObject<any, any, any>;
|
|
592
592
|
export type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
@@ -597,7 +597,7 @@ export interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[ZodTypeAny, Z
|
|
|
597
597
|
export declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
598
598
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
599
599
|
get options(): T;
|
|
600
|
-
static create: <
|
|
600
|
+
static create: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
601
601
|
}
|
|
602
602
|
export type ZodDiscriminatedUnionOption<Discriminator extends string> = ZodObject<{
|
|
603
603
|
[key in Discriminator]: ZodTypeAny;
|
|
@@ -633,7 +633,7 @@ export interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends
|
|
|
633
633
|
}
|
|
634
634
|
export declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
635
635
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
636
|
-
static create: <
|
|
636
|
+
static create: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
637
637
|
}
|
|
638
638
|
export type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
639
639
|
export type AssertArray<T> = T extends any[] ? T : never;
|
|
@@ -655,7 +655,7 @@ export declare class ZodTuple<T extends ZodTupleItems | [] = ZodTupleItems, Rest
|
|
|
655
655
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
656
656
|
get items(): T;
|
|
657
657
|
rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
|
|
658
|
-
static create: <
|
|
658
|
+
static create: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
659
659
|
}
|
|
660
660
|
export interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
661
661
|
valueType: Value;
|
|
@@ -681,7 +681,7 @@ export declare class ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends Z
|
|
|
681
681
|
get keySchema(): Key;
|
|
682
682
|
get valueSchema(): Value;
|
|
683
683
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
684
|
-
static create: <
|
|
684
|
+
static create: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
685
685
|
}
|
|
686
686
|
export interface ZodSetDef<Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
687
687
|
valueType: Value;
|
|
@@ -701,7 +701,7 @@ export declare class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodTy
|
|
|
701
701
|
max(maxSize: number, message?: errorUtil.ErrMessage): this;
|
|
702
702
|
size(size: number, message?: errorUtil.ErrMessage): this;
|
|
703
703
|
nonempty(message?: errorUtil.ErrMessage): ZodSet<Value>;
|
|
704
|
-
static create: <
|
|
704
|
+
static create: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
705
705
|
}
|
|
706
706
|
export interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
707
707
|
args: Args;
|
|
@@ -731,7 +731,7 @@ export interface ZodLazyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDe
|
|
|
731
731
|
export declare class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef<T>, input<T>> {
|
|
732
732
|
get schema(): T;
|
|
733
733
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
734
|
-
static create: <
|
|
734
|
+
static create: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
735
735
|
}
|
|
736
736
|
export interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
737
737
|
value: T;
|
|
@@ -740,7 +740,7 @@ export interface ZodLiteralDef<T = any> extends ZodTypeDef {
|
|
|
740
740
|
export declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
741
741
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
742
742
|
get value(): T;
|
|
743
|
-
static create: <
|
|
743
|
+
static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
744
744
|
}
|
|
745
745
|
export type ArrayKeys = keyof any[];
|
|
746
746
|
export type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
@@ -782,7 +782,7 @@ export declare class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T
|
|
|
782
782
|
#private;
|
|
783
783
|
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
784
784
|
get enum(): T;
|
|
785
|
-
static create: <
|
|
785
|
+
static create: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
786
786
|
}
|
|
787
787
|
export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
788
788
|
type: T;
|
|
@@ -791,7 +791,7 @@ export interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTyp
|
|
|
791
791
|
export declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
792
792
|
unwrap(): T;
|
|
793
793
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
794
|
-
static create: <
|
|
794
|
+
static create: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
795
795
|
}
|
|
796
796
|
export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
797
797
|
export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
@@ -829,7 +829,7 @@ export type ZodOptionalType<T extends ZodTypeAny> = ZodOptional<T>;
|
|
|
829
829
|
export declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
830
830
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
831
831
|
unwrap(): T;
|
|
832
|
-
static create: <
|
|
832
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
833
833
|
}
|
|
834
834
|
export interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
835
835
|
innerType: T;
|
|
@@ -839,7 +839,7 @@ export type ZodNullableType<T extends ZodTypeAny> = ZodNullable<T>;
|
|
|
839
839
|
export declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
840
840
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
841
841
|
unwrap(): T;
|
|
842
|
-
static create: <
|
|
842
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
843
843
|
}
|
|
844
844
|
export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
845
845
|
innerType: T;
|
|
@@ -849,9 +849,9 @@ export interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTyp
|
|
|
849
849
|
export declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
850
850
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
851
851
|
removeDefault(): T;
|
|
852
|
-
static create: <
|
|
853
|
-
default:
|
|
854
|
-
}) => ZodDefault<
|
|
852
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
853
|
+
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
854
|
+
}) => ZodDefault<Inner>;
|
|
855
855
|
}
|
|
856
856
|
export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
857
857
|
innerType: T;
|
|
@@ -864,9 +864,9 @@ export interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeD
|
|
|
864
864
|
export declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
865
865
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
866
866
|
removeCatch(): T;
|
|
867
|
-
static create: <
|
|
868
|
-
catch:
|
|
869
|
-
}) => ZodCatch<
|
|
867
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
|
|
868
|
+
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
869
|
+
}) => ZodCatch<Inner>;
|
|
870
870
|
}
|
|
871
871
|
export interface ZodNaNDef extends ZodTypeDef {
|
|
872
872
|
typeName: ZodFirstPartyTypeKind.ZodNaN;
|
|
@@ -896,7 +896,7 @@ export interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> exte
|
|
|
896
896
|
}
|
|
897
897
|
export declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
898
898
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
899
|
-
static create<
|
|
899
|
+
static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(a: ASchema, b: BSchema): ZodPipeline<ASchema, BSchema>;
|
|
900
900
|
}
|
|
901
901
|
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
902
902
|
readonly [Symbol.toStringTag]: string;
|
|
@@ -908,7 +908,7 @@ export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTy
|
|
|
908
908
|
}
|
|
909
909
|
export declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
910
910
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
911
|
-
static create: <
|
|
911
|
+
static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodReadonly<Inner>;
|
|
912
912
|
unwrap(): T;
|
|
913
913
|
}
|
|
914
914
|
type CustomParams = CustomErrorParams & {
|
|
@@ -928,7 +928,7 @@ export declare function custom<T>(check?: (data: any) => any, _params?: string |
|
|
|
928
928
|
fatal?: boolean): ZodType<T, ZodTypeDef, T>;
|
|
929
929
|
export { ZodType as Schema, ZodType as ZodSchema };
|
|
930
930
|
export declare const late: {
|
|
931
|
-
object: <
|
|
931
|
+
object: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
|
|
932
932
|
};
|
|
933
933
|
export declare enum ZodFirstPartyTypeKind {
|
|
934
934
|
ZodString = "ZodString",
|
|
@@ -996,25 +996,25 @@ declare const anyType: (params?: RawCreateParams) => ZodAny;
|
|
|
996
996
|
declare const unknownType: (params?: RawCreateParams) => ZodUnknown;
|
|
997
997
|
declare const neverType: (params?: RawCreateParams) => ZodNever;
|
|
998
998
|
declare const voidType: (params?: RawCreateParams) => ZodVoid;
|
|
999
|
-
declare const arrayType: <
|
|
1000
|
-
declare const objectType: <
|
|
1001
|
-
declare const strictObjectType: <
|
|
1002
|
-
declare const unionType: <
|
|
999
|
+
declare const arrayType: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
|
|
1000
|
+
declare const objectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
|
|
1001
|
+
declare const strictObjectType: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
|
|
1002
|
+
declare const unionType: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
|
|
1003
1003
|
declare const discriminatedUnionType: typeof ZodDiscriminatedUnion.create;
|
|
1004
|
-
declare const intersectionType: <
|
|
1005
|
-
declare const tupleType: <
|
|
1004
|
+
declare const intersectionType: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
|
|
1005
|
+
declare const tupleType: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
|
|
1006
1006
|
declare const recordType: typeof ZodRecord.create;
|
|
1007
|
-
declare const mapType: <
|
|
1008
|
-
declare const setType: <
|
|
1007
|
+
declare const mapType: <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => ZodMap<KeySchema, ValueSchema>;
|
|
1008
|
+
declare const setType: <ValueSchema extends ZodTypeAny = ZodTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => ZodSet<ValueSchema>;
|
|
1009
1009
|
declare const functionType: typeof ZodFunction.create;
|
|
1010
|
-
declare const lazyType: <
|
|
1011
|
-
declare const literalType: <
|
|
1010
|
+
declare const lazyType: <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams) => ZodLazy<Inner>;
|
|
1011
|
+
declare const literalType: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
|
|
1012
1012
|
declare const enumType: typeof createZodEnum;
|
|
1013
|
-
declare const nativeEnumType: <
|
|
1014
|
-
declare const promiseType: <
|
|
1013
|
+
declare const nativeEnumType: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => ZodNativeEnum<Elements>;
|
|
1014
|
+
declare const promiseType: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
|
|
1015
1015
|
declare const effectsType: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
|
|
1016
|
-
declare const optionalType: <
|
|
1017
|
-
declare const nullableType: <
|
|
1016
|
+
declare const optionalType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
|
|
1017
|
+
declare const nullableType: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
|
|
1018
1018
|
declare const preprocessType: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1019
1019
|
declare const pipelineType: typeof ZodPipeline.create;
|
|
1020
1020
|
declare const ostring: () => ZodOptional<ZodString>;
|
package/package.json
CHANGED
package/src/v3/types.ts
CHANGED
|
@@ -2340,7 +2340,7 @@ export class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality
|
|
|
2340
2340
|
return this.min(1, message) as any;
|
|
2341
2341
|
}
|
|
2342
2342
|
|
|
2343
|
-
static create = <
|
|
2343
|
+
static create = <El extends ZodTypeAny>(schema: El, params?: RawCreateParams): ZodArray<El> => {
|
|
2344
2344
|
return new ZodArray({
|
|
2345
2345
|
type: schema,
|
|
2346
2346
|
minLength: null,
|
|
@@ -2874,15 +2874,15 @@ export class ZodObject<
|
|
|
2874
2874
|
return createZodEnum(util.objectKeys(this.shape) as [string, ...string[]]) as any;
|
|
2875
2875
|
}
|
|
2876
2876
|
|
|
2877
|
-
static create = <
|
|
2878
|
-
shape:
|
|
2877
|
+
static create = <Shape extends ZodRawShape>(
|
|
2878
|
+
shape: Shape,
|
|
2879
2879
|
params?: RawCreateParams
|
|
2880
2880
|
): ZodObject<
|
|
2881
|
-
|
|
2881
|
+
Shape,
|
|
2882
2882
|
"strip",
|
|
2883
2883
|
ZodTypeAny,
|
|
2884
|
-
objectOutputType<
|
|
2885
|
-
objectInputType<
|
|
2884
|
+
objectOutputType<Shape, ZodTypeAny, "strip">,
|
|
2885
|
+
objectInputType<Shape, ZodTypeAny, "strip">
|
|
2886
2886
|
> => {
|
|
2887
2887
|
return new ZodObject({
|
|
2888
2888
|
shape: () => shape,
|
|
@@ -2893,7 +2893,10 @@ export class ZodObject<
|
|
|
2893
2893
|
}) as any;
|
|
2894
2894
|
};
|
|
2895
2895
|
|
|
2896
|
-
static strictCreate = <
|
|
2896
|
+
static strictCreate = <Shape extends ZodRawShape>(
|
|
2897
|
+
shape: Shape,
|
|
2898
|
+
params?: RawCreateParams
|
|
2899
|
+
): ZodObject<Shape, "strict"> => {
|
|
2897
2900
|
return new ZodObject({
|
|
2898
2901
|
shape: () => shape,
|
|
2899
2902
|
unknownKeys: "strict",
|
|
@@ -2903,7 +2906,10 @@ export class ZodObject<
|
|
|
2903
2906
|
}) as any;
|
|
2904
2907
|
};
|
|
2905
2908
|
|
|
2906
|
-
static lazycreate = <
|
|
2909
|
+
static lazycreate = <Shape extends ZodRawShape>(
|
|
2910
|
+
shape: () => Shape,
|
|
2911
|
+
params?: RawCreateParams
|
|
2912
|
+
): ZodObject<Shape, "strip"> => {
|
|
2907
2913
|
return new ZodObject({
|
|
2908
2914
|
shape,
|
|
2909
2915
|
unknownKeys: "strip",
|
|
@@ -3035,10 +3041,10 @@ export class ZodUnion<T extends ZodUnionOptions> extends ZodType<
|
|
|
3035
3041
|
return this._def.options;
|
|
3036
3042
|
}
|
|
3037
3043
|
|
|
3038
|
-
static create = <
|
|
3039
|
-
types:
|
|
3044
|
+
static create = <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(
|
|
3045
|
+
types: Options,
|
|
3040
3046
|
params?: RawCreateParams
|
|
3041
|
-
): ZodUnion<
|
|
3047
|
+
): ZodUnion<Options> => {
|
|
3042
3048
|
return new ZodUnion({
|
|
3043
3049
|
options: types,
|
|
3044
3050
|
typeName: ZodFirstPartyTypeKind.ZodUnion,
|
|
@@ -3335,11 +3341,11 @@ export class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends
|
|
|
3335
3341
|
}
|
|
3336
3342
|
}
|
|
3337
3343
|
|
|
3338
|
-
static create = <
|
|
3339
|
-
left:
|
|
3340
|
-
right:
|
|
3344
|
+
static create = <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(
|
|
3345
|
+
left: TSchema,
|
|
3346
|
+
right: USchema,
|
|
3341
3347
|
params?: RawCreateParams
|
|
3342
|
-
): ZodIntersection<
|
|
3348
|
+
): ZodIntersection<TSchema, USchema> => {
|
|
3343
3349
|
return new ZodIntersection({
|
|
3344
3350
|
left: left,
|
|
3345
3351
|
right: right,
|
|
@@ -3451,10 +3457,10 @@ export class ZodTuple<
|
|
|
3451
3457
|
});
|
|
3452
3458
|
}
|
|
3453
3459
|
|
|
3454
|
-
static create = <
|
|
3455
|
-
schemas:
|
|
3460
|
+
static create = <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(
|
|
3461
|
+
schemas: Items,
|
|
3456
3462
|
params?: RawCreateParams
|
|
3457
|
-
): ZodTuple<
|
|
3463
|
+
): ZodTuple<Items, null> => {
|
|
3458
3464
|
if (!Array.isArray(schemas)) {
|
|
3459
3465
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
3460
3466
|
}
|
|
@@ -3646,11 +3652,11 @@ export class ZodMap<Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAn
|
|
|
3646
3652
|
return { status: status.value, value: finalMap };
|
|
3647
3653
|
}
|
|
3648
3654
|
}
|
|
3649
|
-
static create = <
|
|
3650
|
-
keyType:
|
|
3651
|
-
valueType:
|
|
3655
|
+
static create = <KeySchema extends ZodTypeAny = ZodTypeAny, ValueSchema extends ZodTypeAny = ZodTypeAny>(
|
|
3656
|
+
keyType: KeySchema,
|
|
3657
|
+
valueType: ValueSchema,
|
|
3652
3658
|
params?: RawCreateParams
|
|
3653
|
-
): ZodMap<
|
|
3659
|
+
): ZodMap<KeySchema, ValueSchema> => {
|
|
3654
3660
|
return new ZodMap({
|
|
3655
3661
|
valueType,
|
|
3656
3662
|
keyType,
|
|
@@ -3765,10 +3771,10 @@ export class ZodSet<Value extends ZodTypeAny = ZodTypeAny> extends ZodType<
|
|
|
3765
3771
|
return this.min(1, message) as any;
|
|
3766
3772
|
}
|
|
3767
3773
|
|
|
3768
|
-
static create = <
|
|
3769
|
-
valueType:
|
|
3774
|
+
static create = <ValueSchema extends ZodTypeAny = ZodTypeAny>(
|
|
3775
|
+
valueType: ValueSchema,
|
|
3770
3776
|
params?: RawCreateParams
|
|
3771
|
-
): ZodSet<
|
|
3777
|
+
): ZodSet<ValueSchema> => {
|
|
3772
3778
|
return new ZodSet({
|
|
3773
3779
|
valueType,
|
|
3774
3780
|
minSize: null,
|
|
@@ -3973,7 +3979,7 @@ export class ZodLazy<T extends ZodTypeAny> extends ZodType<output<T>, ZodLazyDef
|
|
|
3973
3979
|
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
3974
3980
|
}
|
|
3975
3981
|
|
|
3976
|
-
static create = <
|
|
3982
|
+
static create = <Inner extends ZodTypeAny>(getter: () => Inner, params?: RawCreateParams): ZodLazy<Inner> => {
|
|
3977
3983
|
return new ZodLazy({
|
|
3978
3984
|
getter: getter,
|
|
3979
3985
|
typeName: ZodFirstPartyTypeKind.ZodLazy,
|
|
@@ -4012,7 +4018,7 @@ export class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
|
|
|
4012
4018
|
return this._def.value;
|
|
4013
4019
|
}
|
|
4014
4020
|
|
|
4015
|
-
static create = <
|
|
4021
|
+
static create = <Value extends Primitive>(value: Value, params?: RawCreateParams): ZodLiteral<Value> => {
|
|
4016
4022
|
return new ZodLiteral({
|
|
4017
4023
|
value: value,
|
|
4018
4024
|
typeName: ZodFirstPartyTypeKind.ZodLiteral,
|
|
@@ -4202,7 +4208,7 @@ export class ZodNativeEnum<T extends EnumLike> extends ZodType<T[keyof T], ZodNa
|
|
|
4202
4208
|
return this._def.values;
|
|
4203
4209
|
}
|
|
4204
4210
|
|
|
4205
|
-
static create = <
|
|
4211
|
+
static create = <Elements extends EnumLike>(values: Elements, params?: RawCreateParams): ZodNativeEnum<Elements> => {
|
|
4206
4212
|
return new ZodNativeEnum({
|
|
4207
4213
|
values: values,
|
|
4208
4214
|
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
|
|
@@ -4255,7 +4261,7 @@ export class ZodPromise<T extends ZodTypeAny> extends ZodType<
|
|
|
4255
4261
|
);
|
|
4256
4262
|
}
|
|
4257
4263
|
|
|
4258
|
-
static create = <
|
|
4264
|
+
static create = <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams): ZodPromise<Inner> => {
|
|
4259
4265
|
return new ZodPromise({
|
|
4260
4266
|
type: schema,
|
|
4261
4267
|
typeName: ZodFirstPartyTypeKind.ZodPromise,
|
|
@@ -4490,7 +4496,7 @@ export class ZodOptional<T extends ZodTypeAny> extends ZodType<
|
|
|
4490
4496
|
return this._def.innerType;
|
|
4491
4497
|
}
|
|
4492
4498
|
|
|
4493
|
-
static create = <
|
|
4499
|
+
static create = <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams): ZodOptional<Inner> => {
|
|
4494
4500
|
return new ZodOptional({
|
|
4495
4501
|
innerType: type,
|
|
4496
4502
|
typeName: ZodFirstPartyTypeKind.ZodOptional,
|
|
@@ -4530,7 +4536,7 @@ export class ZodNullable<T extends ZodTypeAny> extends ZodType<
|
|
|
4530
4536
|
return this._def.innerType;
|
|
4531
4537
|
}
|
|
4532
4538
|
|
|
4533
|
-
static create = <
|
|
4539
|
+
static create = <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams): ZodNullable<Inner> => {
|
|
4534
4540
|
return new ZodNullable({
|
|
4535
4541
|
innerType: type,
|
|
4536
4542
|
typeName: ZodFirstPartyTypeKind.ZodNullable,
|
|
@@ -4574,12 +4580,12 @@ export class ZodDefault<T extends ZodTypeAny> extends ZodType<
|
|
|
4574
4580
|
return this._def.innerType;
|
|
4575
4581
|
}
|
|
4576
4582
|
|
|
4577
|
-
static create = <
|
|
4578
|
-
type:
|
|
4583
|
+
static create = <Inner extends ZodTypeAny>(
|
|
4584
|
+
type: Inner,
|
|
4579
4585
|
params: RawCreateParams & {
|
|
4580
|
-
default:
|
|
4586
|
+
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
4581
4587
|
}
|
|
4582
|
-
): ZodDefault<
|
|
4588
|
+
): ZodDefault<Inner> => {
|
|
4583
4589
|
return new ZodDefault({
|
|
4584
4590
|
innerType: type,
|
|
4585
4591
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
@@ -4662,12 +4668,12 @@ export class ZodCatch<T extends ZodTypeAny> extends ZodType<
|
|
|
4662
4668
|
return this._def.innerType;
|
|
4663
4669
|
}
|
|
4664
4670
|
|
|
4665
|
-
static create = <
|
|
4666
|
-
type:
|
|
4671
|
+
static create = <Inner extends ZodTypeAny>(
|
|
4672
|
+
type: Inner,
|
|
4667
4673
|
params: RawCreateParams & {
|
|
4668
|
-
catch:
|
|
4674
|
+
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
4669
4675
|
}
|
|
4670
|
-
): ZodCatch<
|
|
4676
|
+
): ZodCatch<Inner> => {
|
|
4671
4677
|
return new ZodCatch({
|
|
4672
4678
|
innerType: type,
|
|
4673
4679
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
@@ -4815,7 +4821,10 @@ export class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends Zod
|
|
|
4815
4821
|
}
|
|
4816
4822
|
}
|
|
4817
4823
|
|
|
4818
|
-
static create<
|
|
4824
|
+
static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(
|
|
4825
|
+
a: ASchema,
|
|
4826
|
+
b: BSchema
|
|
4827
|
+
): ZodPipeline<ASchema, BSchema> {
|
|
4819
4828
|
return new ZodPipeline({
|
|
4820
4829
|
in: a,
|
|
4821
4830
|
out: b,
|
|
@@ -4873,7 +4882,7 @@ export class ZodReadonly<T extends ZodTypeAny> extends ZodType<
|
|
|
4873
4882
|
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
4874
4883
|
}
|
|
4875
4884
|
|
|
4876
|
-
static create = <
|
|
4885
|
+
static create = <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams): ZodReadonly<Inner> => {
|
|
4877
4886
|
return new ZodReadonly({
|
|
4878
4887
|
innerType: type,
|
|
4879
4888
|
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|