zod 3.25.3 → 3.25.5

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.
Files changed (45) hide show
  1. package/dist/commonjs/v3/types.d.ts +38 -38
  2. package/dist/commonjs/v4/classic/errors.d.ts +1 -1
  3. package/dist/commonjs/v4/classic/errors.js +1 -0
  4. package/dist/commonjs/v4/classic/parse.d.ts +1 -1
  5. package/dist/commonjs/v4/classic/parse.js +2 -2
  6. package/dist/commonjs/v4/core/errors.d.ts +1 -1
  7. package/dist/commonjs/v4/core/errors.js +44 -0
  8. package/dist/commonjs/v4/core/parse.js +2 -2
  9. package/dist/esm/v3/types.d.ts +38 -38
  10. package/dist/esm/v4/classic/errors.d.ts +1 -1
  11. package/dist/esm/v4/classic/errors.js +1 -0
  12. package/dist/esm/v4/classic/parse.d.ts +1 -1
  13. package/dist/esm/v4/classic/parse.js +3 -3
  14. package/dist/esm/v4/core/errors.d.ts +1 -1
  15. package/dist/esm/v4/core/errors.js +11 -0
  16. package/dist/esm/v4/core/parse.js +2 -2
  17. package/package.json +1 -1
  18. package/src/v3/types.ts +50 -41
  19. package/src/v4/classic/errors.ts +2 -1
  20. package/src/v4/classic/parse.ts +3 -3
  21. package/src/v4/classic/tests/array.test.ts +42 -46
  22. package/src/v4/classic/tests/async-refinements.test.ts +14 -18
  23. package/src/v4/classic/tests/catch.test.ts +10 -12
  24. package/src/v4/classic/tests/discriminated-unions.test.ts +77 -87
  25. package/src/v4/classic/tests/enum.test.ts +33 -39
  26. package/src/v4/classic/tests/error-utils.test.ts +25 -27
  27. package/src/v4/classic/tests/error.test.ts +115 -128
  28. package/src/v4/classic/tests/literal.test.ts +10 -12
  29. package/src/v4/classic/tests/map.test.ts +60 -68
  30. package/src/v4/classic/tests/nested-refine.test.ts +68 -72
  31. package/src/v4/classic/tests/nonoptional.test.ts +36 -44
  32. package/src/v4/classic/tests/number.test.ts +36 -44
  33. package/src/v4/classic/tests/pipe.test.ts +18 -22
  34. package/src/v4/classic/tests/preprocess.test.ts +91 -107
  35. package/src/v4/classic/tests/primitive.test.ts +9 -11
  36. package/src/v4/classic/tests/record.test.ts +101 -121
  37. package/src/v4/classic/tests/set.test.ts +30 -36
  38. package/src/v4/classic/tests/string.test.ts +50 -60
  39. package/src/v4/classic/tests/template-literal.test.ts +45 -55
  40. package/src/v4/classic/tests/transform.test.ts +36 -46
  41. package/src/v4/classic/tests/tuple.test.ts +54 -66
  42. package/src/v4/core/errors.ts +12 -1
  43. package/src/v4/core/parse.ts +2 -2
  44. package/src/v4/core/tests/index.test.ts +42 -1
  45. package/src/v4/mini/tests/error.test.ts +1 -1
@@ -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: <T extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1>;
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: <T extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectOutputType<T_1, ZodTypeAny, "strip">, objectInputType<T_1, ZodTypeAny, "strip">>;
588
- static strictCreate: <T extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict">;
589
- static lazycreate: <T extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip">;
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: <T extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
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: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
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: <T extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
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: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
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: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
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: <T extends ZodTypeAny>(getter: () => T_1, params?: RawCreateParams) => ZodLazy<T_1>;
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: <T extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
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: <T extends EnumLike>(values: T_1, params?: RawCreateParams) => ZodNativeEnum<T_1>;
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: <T extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params: RawCreateParams & {
853
- default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
854
- }) => ZodDefault<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params: RawCreateParams & {
868
- catch: T_1["_output"] | (() => T_1["_output"]);
869
- }) => ZodCatch<T_1>;
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<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
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: <T extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodReadonly<T_1>;
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: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip">;
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: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T>;
1000
- declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, objectOutputType<T, ZodTypeAny, "strip">, objectInputType<T, ZodTypeAny, "strip">>;
1001
- declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict">;
1002
- declare const unionType: <T extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: T, params?: RawCreateParams) => ZodUnion<T>;
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: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
1005
- declare const tupleType: <T extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
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: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
1008
- declare const setType: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
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: <T extends ZodTypeAny>(getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
1011
- declare const literalType: <T extends Primitive>(value: T, params?: RawCreateParams) => ZodLiteral<T>;
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: <T extends EnumLike>(values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
1014
- declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>;
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: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>;
1017
- declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>;
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>;
@@ -2,7 +2,7 @@ import * as core from "zod/v4/core";
2
2
  import { $ZodError } from "zod/v4/core";
3
3
  /** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
4
4
  export type ZodIssue = core.$ZodIssue;
5
- /** An Error-like class that doesn't extend `Error`. Used inside safeParse. */
5
+ /** An Error-like class used to store Zod validation issues. */
6
6
  export interface ZodError<T = unknown> extends $ZodError<T> {
7
7
  /** @deprecated Use the `z.treeifyError(err)` function instead. */
8
8
  format(): core.$ZodFormattedError<T>;
@@ -38,6 +38,7 @@ const core = __importStar(require("zod/v4/core"));
38
38
  const core_1 = require("zod/v4/core");
39
39
  const initializer = (inst, issues) => {
40
40
  core_1.$ZodError.init(inst, issues);
41
+ inst.name = "ZodError";
41
42
  Object.defineProperties(inst, {
42
43
  format: {
43
44
  value: (mapper) => core.formatError(inst, mapper),
@@ -1,5 +1,5 @@
1
1
  import * as core from "zod/v4/core";
2
- import { ZodError } from "./errors.js";
2
+ import { type ZodError } from "./errors.js";
3
3
  export type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
4
4
  export type ZodSafeParseSuccess<T> = {
5
5
  success: true;
@@ -38,5 +38,5 @@ const core = __importStar(require("zod/v4/core"));
38
38
  const errors_js_1 = require("./errors.js");
39
39
  exports.parse = core._parse(errors_js_1.ZodRealError);
40
40
  exports.parseAsync = core._parseAsync(errors_js_1.ZodRealError);
41
- exports.safeParse = core._safeParse(errors_js_1.ZodError);
42
- exports.safeParseAsync = core._safeParseAsync(errors_js_1.ZodError);
41
+ exports.safeParse = core._safeParse(errors_js_1.ZodRealError);
42
+ exports.safeParseAsync = core._safeParseAsync(errors_js_1.ZodRealError);
@@ -1,7 +1,7 @@
1
1
  import type { $ZodCheck, $ZodStringFormats } from "./checks.js";
2
2
  import { $constructor } from "./core.js";
3
3
  import type { $ZodType } from "./schemas.js";
4
- import type * as util from "./util.js";
4
+ import * as util from "./util.js";
5
5
  export interface $ZodIssueBase {
6
6
  readonly code?: string;
7
7
  readonly input?: unknown;
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.$ZodRealError = exports.$ZodError = void 0;
4
37
  exports.flattenError = flattenError;
@@ -7,15 +40,26 @@ exports.treeifyError = treeifyError;
7
40
  exports.toDotPath = toDotPath;
8
41
  exports.prettifyError = prettifyError;
9
42
  const core_js_1 = require("./core.js");
43
+ const util = __importStar(require("./util.js"));
10
44
  const initializer = (inst, def) => {
45
+ inst.name = "$ZodError";
11
46
  Object.defineProperty(inst, "_zod", {
12
47
  value: inst._zod,
13
48
  enumerable: false,
14
49
  });
15
50
  Object.defineProperty(inst, "issues", {
16
51
  value: def,
52
+ enumerable: false,
53
+ });
54
+ // inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);
55
+ Object.defineProperty(inst, "message", {
56
+ get() {
57
+ return JSON.stringify(def, util.jsonStringifyReplacer, 2);
58
+ },
17
59
  enumerable: true,
60
+ // configurable: false,
18
61
  });
62
+ // inst.toString = () => inst.message;
19
63
  // inst.message = `Invalid input`;
20
64
  // Object.defineProperty(inst, "message", {
21
65
  // get() {
@@ -80,7 +80,7 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
80
80
  : { success: true, data: result.value };
81
81
  };
82
82
  exports._safeParse = _safeParse;
83
- exports.safeParse = (0, exports._safeParse)(errors.$ZodError);
83
+ exports.safeParse = (0, exports._safeParse)(errors.$ZodRealError);
84
84
  const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
85
85
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
86
86
  let result = schema._zod.run({ value, issues: [] }, ctx);
@@ -94,4 +94,4 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
94
94
  : { success: true, data: result.value };
95
95
  };
96
96
  exports._safeParseAsync = _safeParseAsync;
97
- exports.safeParseAsync = (0, exports._safeParseAsync)(errors.$ZodError);
97
+ exports.safeParseAsync = (0, exports._safeParseAsync)(errors.$ZodRealError);
@@ -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: <T extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1>;
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: <T extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, objectOutputType<T_1, ZodTypeAny, "strip">, objectInputType<T_1, ZodTypeAny, "strip">>;
588
- static strictCreate: <T extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict">;
589
- static lazycreate: <T extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip">;
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: <T extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
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: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
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: <T extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
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: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key_1, valueType: Value_1, params?: RawCreateParams) => ZodMap<Key_1, Value_1>;
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: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value_1, params?: RawCreateParams) => ZodSet<Value_1>;
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: <T extends ZodTypeAny>(getter: () => T_1, params?: RawCreateParams) => ZodLazy<T_1>;
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: <T extends Primitive>(value: T_1, params?: RawCreateParams) => ZodLiteral<T_1>;
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: <T extends EnumLike>(values: T_1, params?: RawCreateParams) => ZodNativeEnum<T_1>;
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: <T extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params: RawCreateParams & {
853
- default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
854
- }) => ZodDefault<T_1>;
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: <T extends ZodTypeAny>(type: T_1, params: RawCreateParams & {
868
- catch: T_1["_output"] | (() => T_1["_output"]);
869
- }) => ZodCatch<T_1>;
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<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
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: <T extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodReadonly<T_1>;
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: <T extends ZodRawShape>(shape: () => T, params?: RawCreateParams) => ZodObject<T, "strip">;
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: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodArray<T>;
1000
- declare const objectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strip", ZodTypeAny, objectOutputType<T, ZodTypeAny, "strip">, objectInputType<T, ZodTypeAny, "strip">>;
1001
- declare const strictObjectType: <T extends ZodRawShape>(shape: T, params?: RawCreateParams) => ZodObject<T, "strict">;
1002
- declare const unionType: <T extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: T, params?: RawCreateParams) => ZodUnion<T>;
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: <T extends ZodTypeAny, U extends ZodTypeAny>(left: T, right: U, params?: RawCreateParams) => ZodIntersection<T, U>;
1005
- declare const tupleType: <T extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: T, params?: RawCreateParams) => ZodTuple<T, null>;
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: <Key extends ZodTypeAny = ZodTypeAny, Value extends ZodTypeAny = ZodTypeAny>(keyType: Key, valueType: Value, params?: RawCreateParams) => ZodMap<Key, Value>;
1008
- declare const setType: <Value extends ZodTypeAny = ZodTypeAny>(valueType: Value, params?: RawCreateParams) => ZodSet<Value>;
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: <T extends ZodTypeAny>(getter: () => T, params?: RawCreateParams) => ZodLazy<T>;
1011
- declare const literalType: <T extends Primitive>(value: T, params?: RawCreateParams) => ZodLiteral<T>;
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: <T extends EnumLike>(values: T, params?: RawCreateParams) => ZodNativeEnum<T>;
1014
- declare const promiseType: <T extends ZodTypeAny>(schema: T, params?: RawCreateParams) => ZodPromise<T>;
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: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodOptional<T>;
1017
- declare const nullableType: <T extends ZodTypeAny>(type: T, params?: RawCreateParams) => ZodNullable<T>;
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>;
@@ -2,7 +2,7 @@ import * as core from "zod/v4/core";
2
2
  import { $ZodError } from "zod/v4/core";
3
3
  /** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
4
4
  export type ZodIssue = core.$ZodIssue;
5
- /** An Error-like class that doesn't extend `Error`. Used inside safeParse. */
5
+ /** An Error-like class used to store Zod validation issues. */
6
6
  export interface ZodError<T = unknown> extends $ZodError<T> {
7
7
  /** @deprecated Use the `z.treeifyError(err)` function instead. */
8
8
  format(): core.$ZodFormattedError<T>;
@@ -2,6 +2,7 @@ import * as core from "zod/v4/core";
2
2
  import { $ZodError } from "zod/v4/core";
3
3
  const initializer = (inst, issues) => {
4
4
  $ZodError.init(inst, issues);
5
+ inst.name = "ZodError";
5
6
  Object.defineProperties(inst, {
6
7
  format: {
7
8
  value: (mapper) => core.formatError(inst, mapper),
@@ -1,5 +1,5 @@
1
1
  import * as core from "zod/v4/core";
2
- import { ZodError } from "./errors.js";
2
+ import { type ZodError } from "./errors.js";
3
3
  export type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
4
4
  export type ZodSafeParseSuccess<T> = {
5
5
  success: true;
@@ -1,6 +1,6 @@
1
1
  import * as core from "zod/v4/core";
2
- import { ZodError, ZodRealError } from "./errors.js";
2
+ import { ZodRealError } from "./errors.js";
3
3
  export const parse = /* @__PURE__ */ core._parse(ZodRealError);
4
4
  export const parseAsync = /* @__PURE__ */ core._parseAsync(ZodRealError);
5
- export const safeParse = /* @__PURE__ */ core._safeParse(ZodError);
6
- export const safeParseAsync = /* @__PURE__ */ core._safeParseAsync(ZodError);
5
+ export const safeParse = /* @__PURE__ */ core._safeParse(ZodRealError);
6
+ export const safeParseAsync = /* @__PURE__ */ core._safeParseAsync(ZodRealError);
@@ -1,7 +1,7 @@
1
1
  import type { $ZodCheck, $ZodStringFormats } from "./checks.js";
2
2
  import { $constructor } from "./core.js";
3
3
  import type { $ZodType } from "./schemas.js";
4
- import type * as util from "./util.js";
4
+ import * as util from "./util.js";
5
5
  export interface $ZodIssueBase {
6
6
  readonly code?: string;
7
7
  readonly input?: unknown;