zod 4.0.0-beta.20250418T202744 → 4.0.0-beta.20250424T163858

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.
@@ -27,12 +27,12 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
27
27
  /** @deprecated Use `.check()` instead. */
28
28
  superRefine(refinement: (arg: core.output<this>, ctx: RefinementCtx<this["_zod"]["output"]>) => void | Promise<void>): this;
29
29
  overwrite(fn: (x: core.output<this>) => core.output<this>): this;
30
- optional(params?: core.$ZodOptionalParams): ZodOptional<this>;
31
- nonoptional(params?: core.$ZodNonOptionalParams): ZodNonOptional<this>;
32
- nullable(params?: core.$ZodNullableParams): ZodNullable<this>;
30
+ optional(params?: string | core.$ZodOptionalParams): ZodOptional<this>;
31
+ nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
32
+ nullable(params?: string | core.$ZodNullableParams): ZodNullable<this>;
33
33
  nullish(): ZodOptional<ZodNullable<this>>;
34
- default(def: util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
35
- default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
34
+ default(def: util.NoUndefined<core.output<this>>, params?: string | core.$ZodDefaultParams): ZodDefault<this>;
35
+ default(def: () => util.NoUndefined<core.output<this>>, params?: string | core.$ZodDefaultParams): ZodDefault<this>;
36
36
  array(): ZodArray<this>;
37
37
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
38
38
  and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
@@ -111,7 +111,7 @@ export interface _ZodString<Input = unknown> extends ZodType {
111
111
  time(params?: string | core.$ZodCheckISOTimeParams): this;
112
112
  /** @deprecated Use `z.iso.duration()` instead. */
113
113
  duration(params?: string | core.$ZodCheckISODurationParams): this;
114
- regex(regex: RegExp, params?: core.$ZodCheckRegexParams): this;
114
+ regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
115
115
  includes(value: string, params?: {
116
116
  message?: string;
117
117
  position?: number;
@@ -385,7 +385,7 @@ export interface ZodArray<T extends core.$ZodType = core.$ZodType> extends ZodTy
385
385
  length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
386
386
  }
387
387
  export declare const ZodArray: core.$constructor<ZodArray>;
388
- export declare function array<T extends core.$ZodType>(element: T, params?: core.$ZodArrayParams): ZodArray<T>;
388
+ export declare function array<T extends core.$ZodType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
389
389
  export interface ZodObjectLike<out O = object, out I = object> extends ZodType {
390
390
  _zod: core.$ZodObjectLikeInternals<O, I>;
391
391
  }
@@ -450,10 +450,10 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
450
450
  required<M extends util.Mask<string & keyof Shape>>(mask: M): ZodInterfaceRequired<this, string & keyof M>;
451
451
  }
452
452
  export declare const ZodInterface: core.$constructor<ZodInterface>;
453
- declare function _interface<T extends core.$ZodLooseShape>(shape: T, params?: core.$ZodInterfaceParams, Class?: util.Constructor<ZodInterface>): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
453
+ declare function _interface<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodInterfaceParams, Class?: util.Constructor<ZodInterface>): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
454
454
  export { _interface as interface };
455
- export declare function strictInterface<T extends core.$ZodLooseShape>(shape: T, params?: core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
456
- export declare function looseInterface<T extends core.$ZodLooseShape>(shape: T, params?: core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, Record<string, unknown>>>;
455
+ export declare function strictInterface<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
456
+ export declare function looseInterface<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, Record<string, unknown>>>;
457
457
  export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Extra extends Record<string, unknown> = Record<string, unknown>> extends ZodType {
458
458
  _zod: core.$ZodObjectInternals<Shape, Extra>;
459
459
  shape: Shape;
@@ -486,9 +486,9 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
486
486
  }, Extra>;
487
487
  }
488
488
  export declare const ZodObject: core.$constructor<ZodObject>;
489
- export declare function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(shape?: T, params?: core.$ZodObjectLikeParams): ZodObject<T, {}>;
490
- export declare function strictObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {}>;
491
- export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {
489
+ export declare function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(shape?: T, params?: string | core.$ZodObjectLikeParams): ZodObject<T, {}>;
490
+ export declare function strictObject<T extends core.$ZodShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, {}>;
491
+ export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, {
492
492
  [k: string]: unknown;
493
493
  }>;
494
494
  export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
@@ -560,7 +560,7 @@ export interface ZodUnion<T extends readonly core.$ZodType[] = readonly core.$Zo
560
560
  options: T;
561
561
  }
562
562
  export declare const ZodUnion: core.$constructor<ZodUnion>;
563
- export declare function union<const T extends readonly core.$ZodType[]>(options: T, params?: core.$ZodUnionParams): ZodUnion<T>;
563
+ export declare function union<const T extends readonly core.$ZodType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
564
564
  export interface ZodDiscriminatedUnion<Options extends readonly core.$ZodType[] = readonly core.$ZodType[]> extends ZodUnion<Options> {
565
565
  _zod: core.$ZodDiscriminatedUnionInternals<Options>;
566
566
  }
@@ -571,56 +571,56 @@ export interface $ZodTypeDiscriminableInternals extends core.$ZodTypeInternals {
571
571
  export interface $ZodTypeDiscriminable extends ZodType {
572
572
  _zod: $ZodTypeDiscriminableInternals;
573
573
  }
574
- export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(disc: string, options: Types, params?: core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
575
- export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(options: Types, params?: core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
574
+ export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(disc: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
575
+ export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
576
576
  export interface ZodIntersection<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType> extends ZodType {
577
577
  _zod: core.$ZodIntersectionInternals<A, B>;
578
578
  }
579
579
  export declare const ZodIntersection: core.$constructor<ZodIntersection>;
580
- export declare function intersection<T extends core.$ZodType, U extends core.$ZodType>(left: T, right: U, params?: core.$ZodIntersectionParams): ZodIntersection<T, U>;
580
+ export declare function intersection<T extends core.$ZodType, U extends core.$ZodType>(left: T, right: U, params?: string | core.$ZodIntersectionParams): ZodIntersection<T, U>;
581
581
  export interface ZodTuple<T extends util.TupleItems = util.TupleItems, Rest extends core.$ZodType | null = core.$ZodType | null> extends ZodType {
582
582
  _zod: core.$ZodTupleInternals<T, Rest>;
583
583
  rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
584
584
  }
585
585
  export declare const ZodTuple: core.$constructor<ZodTuple>;
586
- export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(items: T, params?: core.$ZodTupleParams): ZodTuple<T, null>;
587
- export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(items: T, rest: Rest, params?: core.$ZodTupleParams): ZodTuple<T, Rest>;
588
- export declare function tuple(items: [], params?: core.$ZodTupleParams): ZodTuple<[], null>;
586
+ export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null>;
587
+ export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest>;
588
+ export declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
589
589
  export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.$ZodType = core.$ZodType> extends ZodType {
590
590
  _zod: core.$ZodRecordInternals<Key, Value>;
591
591
  keyType: Key;
592
592
  valueType: Value;
593
593
  }
594
594
  export declare const ZodRecord: core.$constructor<ZodRecord>;
595
- export declare function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: core.$ZodRecordParams): ZodRecord<Key, Value>;
596
- export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: core.$ZodRecordParams): ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
595
+ export declare function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value>;
596
+ export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
597
597
  export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType> extends ZodType {
598
598
  _zod: core.$ZodMapInternals<Key, Value>;
599
599
  keyType: Key;
600
600
  valueType: Value;
601
601
  }
602
602
  export declare const ZodMap: core.$constructor<ZodMap>;
603
- export declare function map<Key extends core.$ZodType, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: core.$ZodMapParams): ZodMap<Key, Value>;
603
+ export declare function map<Key extends core.$ZodType, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
604
604
  export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
605
605
  _zod: core.$ZodSetInternals<T>;
606
- min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
606
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
607
607
  /** */
608
- nonempty(params?: core.$ZodCheckMinSizeParams): this;
609
- max(maxSize: number, params?: core.$ZodCheckMaxSizeParams): this;
610
- size(size: number, params?: core.$ZodCheckSizeEqualsParams): this;
608
+ nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
609
+ max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
610
+ size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
611
611
  }
612
612
  export declare const ZodSet: core.$constructor<ZodSet>;
613
- export declare function set<Value extends core.$ZodType>(valueType: Value, params?: core.$ZodSetParams): ZodSet<Value>;
613
+ export declare function set<Value extends core.$ZodType>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value>;
614
614
  export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodType {
615
615
  _zod: core.$ZodEnumInternals<T>;
616
616
  enum: T;
617
617
  options: Array<T[keyof T]>;
618
- extract<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
619
- exclude<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
618
+ extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
619
+ exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
620
620
  }
621
621
  export declare const ZodEnum: core.$constructor<ZodEnum>;
622
- declare function _enum<const T extends readonly string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
623
- declare function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
622
+ declare function _enum<const T extends readonly string[]>(values: T, params?: string | core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
623
+ declare function _enum<const T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
624
624
  export { _enum as enum };
625
625
  /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
626
626
  *
@@ -629,14 +629,14 @@ export { _enum as enum };
629
629
  * z.enum(Colors);
630
630
  * ```
631
631
  */
632
- export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
632
+ export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
633
633
  export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends ZodType {
634
634
  _zod: core.$ZodLiteralInternals<T>;
635
635
  values: Set<T>;
636
636
  }
637
637
  export declare const ZodLiteral: core.$constructor<ZodLiteral>;
638
- export declare function literal<const T extends Array<util.Literal>>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T[number]>;
639
- export declare function literal<const T extends util.Literal>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T>;
638
+ export declare function literal<const T extends Array<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number]>;
639
+ export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T>;
640
640
  export interface ZodFile extends ZodType {
641
641
  _zod: core.$ZodFileInternals;
642
642
  min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
@@ -649,19 +649,19 @@ export interface ZodTransform<O = unknown, I = unknown> extends ZodType {
649
649
  _zod: core.$ZodTransformInternals<O, I>;
650
650
  }
651
651
  export declare const ZodTransform: core.$constructor<ZodTransform>;
652
- export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O, params?: core.$ZodTransformParams): ZodTransform<Awaited<O>, I>;
652
+ export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O, params?: string | core.$ZodTransformParams): ZodTransform<Awaited<O>, I>;
653
653
  export interface ZodOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
654
654
  _zod: core.$ZodOptionalInternals<T>;
655
655
  unwrap(): T;
656
656
  }
657
657
  export declare const ZodOptional: core.$constructor<ZodOptional>;
658
- export declare function optional<T extends core.$ZodType>(innerType: T, params?: core.$ZodOptionalParams): ZodOptional<T>;
658
+ export declare function optional<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodOptionalParams): ZodOptional<T>;
659
659
  export interface ZodNullable<T extends core.$ZodType = core.$ZodType> extends ZodType {
660
660
  _zod: core.$ZodNullableInternals<T>;
661
661
  unwrap(): T;
662
662
  }
663
663
  export declare const ZodNullable: core.$constructor<ZodNullable>;
664
- export declare function nullable<T extends core.$ZodType>(innerType: T, params?: core.$ZodNullableParams): ZodNullable<T>;
664
+ export declare function nullable<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodNullableParams): ZodNullable<T>;
665
665
  export declare function nullish<T extends core.$ZodType>(innerType: T): ZodOptional<ZodNullable<T>>;
666
666
  export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
667
667
  _zod: core.$ZodDefaultInternals<T>;
@@ -670,19 +670,19 @@ export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends Zod
670
670
  removeDefault(): T;
671
671
  }
672
672
  export declare const ZodDefault: core.$constructor<ZodDefault>;
673
- export declare function _default<T extends core.$ZodType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>), params?: core.$ZodDefaultParams): ZodDefault<T>;
673
+ export declare function _default<T extends core.$ZodType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>), params?: string | core.$ZodDefaultParams): ZodDefault<T>;
674
674
  export interface ZodNonOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
675
675
  _zod: core.$ZodNonOptionalInternals<T>;
676
676
  unwrap(): T;
677
677
  }
678
678
  export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
679
- export declare function nonoptional<T extends core.$ZodType>(innerType: T, params?: core.$ZodNonOptionalParams): ZodNonOptional<T>;
679
+ export declare function nonoptional<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T>;
680
680
  export interface ZodSuccess<T extends core.$ZodType = core.$ZodType> extends ZodType {
681
681
  _zod: core.$ZodSuccessInternals<T>;
682
682
  unwrap(): T;
683
683
  }
684
684
  export declare const ZodSuccess: core.$constructor<ZodSuccess>;
685
- export declare function success<T extends core.$ZodType>(innerType: T, params?: core.$ZodSuccessParams): ZodSuccess<T>;
685
+ export declare function success<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodSuccessParams): ZodSuccess<T>;
686
686
  export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodType {
687
687
  _zod: core.$ZodCatchInternals<T>;
688
688
  unwrap(): T;
@@ -690,7 +690,7 @@ export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodTy
690
690
  removeCatch(): T;
691
691
  }
692
692
  export declare const ZodCatch: core.$constructor<ZodCatch>;
693
- declare function _catch<T extends core.$ZodType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>), params?: core.$ZodCatchParams): ZodCatch<T>;
693
+ declare function _catch<T extends core.$ZodType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>), params?: string | core.$ZodCatchParams): ZodCatch<T>;
694
694
  export { _catch as catch };
695
695
  export interface ZodNaN extends ZodType {
696
696
  _zod: core.$ZodNaNInternals;
@@ -703,17 +703,17 @@ export interface ZodPipe<A extends core.$ZodType = core.$ZodType, B extends core
703
703
  out: B;
704
704
  }
705
705
  export declare const ZodPipe: core.$constructor<ZodPipe>;
706
- export declare function pipe<const A extends core.$ZodType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: core.$ZodPipeParams): ZodPipe<A, B>;
706
+ export declare function pipe<const A extends core.$ZodType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: string | core.$ZodPipeParams): ZodPipe<A, B>;
707
707
  export interface ZodReadonly<T extends core.$ZodType = core.$ZodType> extends ZodType {
708
708
  _zod: core.$ZodReadonlyInternals<T>;
709
709
  }
710
710
  export declare const ZodReadonly: core.$constructor<ZodReadonly>;
711
- export declare function readonly<T extends core.$ZodType>(innerType: T, params?: core.$ZodReadonlyParams): ZodReadonly<T>;
711
+ export declare function readonly<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodReadonlyParams): ZodReadonly<T>;
712
712
  export interface ZodTemplateLiteral<Template extends string = string> extends ZodType {
713
713
  _zod: core.$ZodTemplateLiteralInternals<Template>;
714
714
  }
715
715
  export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
716
- export declare function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>(parts: Parts, params?: core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
716
+ export declare function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
717
717
  export interface ZodLazy<T extends core.$ZodType = core.$ZodType> extends ZodType {
718
718
  _zod: core.$ZodLazyInternals<T>;
719
719
  unwrap(): T;
@@ -725,22 +725,22 @@ export interface ZodPromise<T extends core.$ZodType = core.$ZodType> extends Zod
725
725
  unwrap(): T;
726
726
  }
727
727
  export declare const ZodPromise: core.$constructor<ZodPromise>;
728
- export declare function promise<T extends core.$ZodType>(innerType: T, params?: core.$ZodPromiseParams): ZodPromise<T>;
728
+ export declare function promise<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodPromiseParams): ZodPromise<T>;
729
729
  export interface ZodCustom<O = unknown, I = unknown> extends ZodType {
730
730
  _zod: core.$ZodCustomInternals<O, I>;
731
731
  }
732
732
  export declare const ZodCustom: core.$constructor<ZodCustom>;
733
- export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: core.$ZodCustomParams): core.$ZodCheck<O>;
733
+ export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
734
734
  export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, I>;
735
735
  export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
736
- export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>, params?: core.$ZodCustomParams): core.$ZodCheck<T>;
736
+ export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>, params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
737
737
  declare abstract class Class {
738
738
  constructor(..._args: any[]);
739
739
  }
740
740
  type ZodInstanceOfParams = util.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
741
741
  declare function _instanceof<T extends typeof Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>>;
742
742
  export { _instanceof as instanceof };
743
- export declare const stringbool: (_params?: core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
743
+ export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
744
744
  export type ZodJSONSchema = ZodUnion<[
745
745
  ZodString,
746
746
  ZodNumber,
@@ -754,7 +754,7 @@ export type ZodJSONSchema = ZodUnion<[
754
754
  output: util.JSONType;
755
755
  };
756
756
  };
757
- export declare function json(params?: core.$ZodCustomParams): ZodJSONSchema;
757
+ export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
758
758
  export interface ZodPreprocessParams extends core.$ZodTransformParams, core.$ZodPipeParams {
759
759
  }
760
760
  export declare function preprocess<A, U extends core.$ZodType>(fn: (arg: unknown, ctx: RefinementCtx) => A, schema: U, params?: ZodPreprocessParams): ZodPipe<ZodTransform<A, unknown>, U>;
@@ -134,7 +134,7 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
134
134
  ],
135
135
  });
136
136
  };
137
- inst.clone = (_def) => core.clone(inst, _def ?? def);
137
+ inst.clone = (_def) => core.clone(inst, _def);
138
138
  inst.brand = () => inst;
139
139
  inst.register = ((reg, meta) => {
140
140
  reg.add(inst, meta);
@@ -167,8 +167,8 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
167
167
  // meta
168
168
  inst.describe = (description) => {
169
169
  const cl = inst.clone();
170
- const meta = core.globalRegistry.get(inst) ?? {};
171
- meta.description = description;
170
+ const meta = { ...(core.globalRegistry.get(inst) ?? {}), description };
171
+ delete meta.id; // do not inherit
172
172
  core.globalRegistry.add(cl, meta);
173
173
  return cl;
174
174
  };
@@ -27,12 +27,12 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
27
27
  /** @deprecated Use `.check()` instead. */
28
28
  superRefine(refinement: (arg: core.output<this>, ctx: RefinementCtx<this["_zod"]["output"]>) => void | Promise<void>): this;
29
29
  overwrite(fn: (x: core.output<this>) => core.output<this>): this;
30
- optional(params?: core.$ZodOptionalParams): ZodOptional<this>;
31
- nonoptional(params?: core.$ZodNonOptionalParams): ZodNonOptional<this>;
32
- nullable(params?: core.$ZodNullableParams): ZodNullable<this>;
30
+ optional(params?: string | core.$ZodOptionalParams): ZodOptional<this>;
31
+ nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
32
+ nullable(params?: string | core.$ZodNullableParams): ZodNullable<this>;
33
33
  nullish(): ZodOptional<ZodNullable<this>>;
34
- default(def: util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
35
- default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
34
+ default(def: util.NoUndefined<core.output<this>>, params?: string | core.$ZodDefaultParams): ZodDefault<this>;
35
+ default(def: () => util.NoUndefined<core.output<this>>, params?: string | core.$ZodDefaultParams): ZodDefault<this>;
36
36
  array(): ZodArray<this>;
37
37
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
38
38
  and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
@@ -111,7 +111,7 @@ export interface _ZodString<Input = unknown> extends ZodType {
111
111
  time(params?: string | core.$ZodCheckISOTimeParams): this;
112
112
  /** @deprecated Use `z.iso.duration()` instead. */
113
113
  duration(params?: string | core.$ZodCheckISODurationParams): this;
114
- regex(regex: RegExp, params?: core.$ZodCheckRegexParams): this;
114
+ regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
115
115
  includes(value: string, params?: {
116
116
  message?: string;
117
117
  position?: number;
@@ -385,7 +385,7 @@ export interface ZodArray<T extends core.$ZodType = core.$ZodType> extends ZodTy
385
385
  length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
386
386
  }
387
387
  export declare const ZodArray: core.$constructor<ZodArray>;
388
- export declare function array<T extends core.$ZodType>(element: T, params?: core.$ZodArrayParams): ZodArray<T>;
388
+ export declare function array<T extends core.$ZodType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
389
389
  export interface ZodObjectLike<out O = object, out I = object> extends ZodType {
390
390
  _zod: core.$ZodObjectLikeInternals<O, I>;
391
391
  }
@@ -450,10 +450,10 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
450
450
  required<M extends util.Mask<string & keyof Shape>>(mask: M): ZodInterfaceRequired<this, string & keyof M>;
451
451
  }
452
452
  export declare const ZodInterface: core.$constructor<ZodInterface>;
453
- declare function _interface<T extends core.$ZodLooseShape>(shape: T, params?: core.$ZodInterfaceParams, Class?: util.Constructor<ZodInterface>): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
453
+ declare function _interface<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodInterfaceParams, Class?: util.Constructor<ZodInterface>): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
454
454
  export { _interface as interface };
455
- export declare function strictInterface<T extends core.$ZodLooseShape>(shape: T, params?: core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
456
- export declare function looseInterface<T extends core.$ZodLooseShape>(shape: T, params?: core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, Record<string, unknown>>>;
455
+ export declare function strictInterface<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>>;
456
+ export declare function looseInterface<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodInterfaceParams): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, Record<string, unknown>>>;
457
457
  export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Extra extends Record<string, unknown> = Record<string, unknown>> extends ZodType {
458
458
  _zod: core.$ZodObjectInternals<Shape, Extra>;
459
459
  shape: Shape;
@@ -486,9 +486,9 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
486
486
  }, Extra>;
487
487
  }
488
488
  export declare const ZodObject: core.$constructor<ZodObject>;
489
- export declare function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(shape?: T, params?: core.$ZodObjectLikeParams): ZodObject<T, {}>;
490
- export declare function strictObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {}>;
491
- export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {
489
+ export declare function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(shape?: T, params?: string | core.$ZodObjectLikeParams): ZodObject<T, {}>;
490
+ export declare function strictObject<T extends core.$ZodShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, {}>;
491
+ export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, {
492
492
  [k: string]: unknown;
493
493
  }>;
494
494
  export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.Extend<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
@@ -560,7 +560,7 @@ export interface ZodUnion<T extends readonly core.$ZodType[] = readonly core.$Zo
560
560
  options: T;
561
561
  }
562
562
  export declare const ZodUnion: core.$constructor<ZodUnion>;
563
- export declare function union<const T extends readonly core.$ZodType[]>(options: T, params?: core.$ZodUnionParams): ZodUnion<T>;
563
+ export declare function union<const T extends readonly core.$ZodType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
564
564
  export interface ZodDiscriminatedUnion<Options extends readonly core.$ZodType[] = readonly core.$ZodType[]> extends ZodUnion<Options> {
565
565
  _zod: core.$ZodDiscriminatedUnionInternals<Options>;
566
566
  }
@@ -571,56 +571,56 @@ export interface $ZodTypeDiscriminableInternals extends core.$ZodTypeInternals {
571
571
  export interface $ZodTypeDiscriminable extends ZodType {
572
572
  _zod: $ZodTypeDiscriminableInternals;
573
573
  }
574
- export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(disc: string, options: Types, params?: core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
575
- export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(options: Types, params?: core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
574
+ export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(disc: string, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
575
+ export declare function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types>;
576
576
  export interface ZodIntersection<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType> extends ZodType {
577
577
  _zod: core.$ZodIntersectionInternals<A, B>;
578
578
  }
579
579
  export declare const ZodIntersection: core.$constructor<ZodIntersection>;
580
- export declare function intersection<T extends core.$ZodType, U extends core.$ZodType>(left: T, right: U, params?: core.$ZodIntersectionParams): ZodIntersection<T, U>;
580
+ export declare function intersection<T extends core.$ZodType, U extends core.$ZodType>(left: T, right: U, params?: string | core.$ZodIntersectionParams): ZodIntersection<T, U>;
581
581
  export interface ZodTuple<T extends util.TupleItems = util.TupleItems, Rest extends core.$ZodType | null = core.$ZodType | null> extends ZodType {
582
582
  _zod: core.$ZodTupleInternals<T, Rest>;
583
583
  rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
584
584
  }
585
585
  export declare const ZodTuple: core.$constructor<ZodTuple>;
586
- export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(items: T, params?: core.$ZodTupleParams): ZodTuple<T, null>;
587
- export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(items: T, rest: Rest, params?: core.$ZodTupleParams): ZodTuple<T, Rest>;
588
- export declare function tuple(items: [], params?: core.$ZodTupleParams): ZodTuple<[], null>;
586
+ export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null>;
587
+ export declare function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest>;
588
+ export declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
589
589
  export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.$ZodType = core.$ZodType> extends ZodType {
590
590
  _zod: core.$ZodRecordInternals<Key, Value>;
591
591
  keyType: Key;
592
592
  valueType: Value;
593
593
  }
594
594
  export declare const ZodRecord: core.$constructor<ZodRecord>;
595
- export declare function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: core.$ZodRecordParams): ZodRecord<Key, Value>;
596
- export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: core.$ZodRecordParams): ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
595
+ export declare function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value>;
596
+ export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
597
597
  export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType> extends ZodType {
598
598
  _zod: core.$ZodMapInternals<Key, Value>;
599
599
  keyType: Key;
600
600
  valueType: Value;
601
601
  }
602
602
  export declare const ZodMap: core.$constructor<ZodMap>;
603
- export declare function map<Key extends core.$ZodType, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: core.$ZodMapParams): ZodMap<Key, Value>;
603
+ export declare function map<Key extends core.$ZodType, Value extends core.$ZodType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
604
604
  export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
605
605
  _zod: core.$ZodSetInternals<T>;
606
- min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
606
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
607
607
  /** */
608
- nonempty(params?: core.$ZodCheckMinSizeParams): this;
609
- max(maxSize: number, params?: core.$ZodCheckMaxSizeParams): this;
610
- size(size: number, params?: core.$ZodCheckSizeEqualsParams): this;
608
+ nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
609
+ max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
610
+ size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
611
611
  }
612
612
  export declare const ZodSet: core.$constructor<ZodSet>;
613
- export declare function set<Value extends core.$ZodType>(valueType: Value, params?: core.$ZodSetParams): ZodSet<Value>;
613
+ export declare function set<Value extends core.$ZodType>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value>;
614
614
  export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodType {
615
615
  _zod: core.$ZodEnumInternals<T>;
616
616
  enum: T;
617
617
  options: Array<T[keyof T]>;
618
- extract<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
619
- exclude<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
618
+ extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
619
+ exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
620
620
  }
621
621
  export declare const ZodEnum: core.$constructor<ZodEnum>;
622
- declare function _enum<const T extends readonly string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
623
- declare function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
622
+ declare function _enum<const T extends readonly string[]>(values: T, params?: string | core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
623
+ declare function _enum<const T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
624
624
  export { _enum as enum };
625
625
  /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
626
626
  *
@@ -629,14 +629,14 @@ export { _enum as enum };
629
629
  * z.enum(Colors);
630
630
  * ```
631
631
  */
632
- export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
632
+ export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
633
633
  export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends ZodType {
634
634
  _zod: core.$ZodLiteralInternals<T>;
635
635
  values: Set<T>;
636
636
  }
637
637
  export declare const ZodLiteral: core.$constructor<ZodLiteral>;
638
- export declare function literal<const T extends Array<util.Literal>>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T[number]>;
639
- export declare function literal<const T extends util.Literal>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T>;
638
+ export declare function literal<const T extends Array<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number]>;
639
+ export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T>;
640
640
  export interface ZodFile extends ZodType {
641
641
  _zod: core.$ZodFileInternals;
642
642
  min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
@@ -649,19 +649,19 @@ export interface ZodTransform<O = unknown, I = unknown> extends ZodType {
649
649
  _zod: core.$ZodTransformInternals<O, I>;
650
650
  }
651
651
  export declare const ZodTransform: core.$constructor<ZodTransform>;
652
- export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O, params?: core.$ZodTransformParams): ZodTransform<Awaited<O>, I>;
652
+ export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O, params?: string | core.$ZodTransformParams): ZodTransform<Awaited<O>, I>;
653
653
  export interface ZodOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
654
654
  _zod: core.$ZodOptionalInternals<T>;
655
655
  unwrap(): T;
656
656
  }
657
657
  export declare const ZodOptional: core.$constructor<ZodOptional>;
658
- export declare function optional<T extends core.$ZodType>(innerType: T, params?: core.$ZodOptionalParams): ZodOptional<T>;
658
+ export declare function optional<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodOptionalParams): ZodOptional<T>;
659
659
  export interface ZodNullable<T extends core.$ZodType = core.$ZodType> extends ZodType {
660
660
  _zod: core.$ZodNullableInternals<T>;
661
661
  unwrap(): T;
662
662
  }
663
663
  export declare const ZodNullable: core.$constructor<ZodNullable>;
664
- export declare function nullable<T extends core.$ZodType>(innerType: T, params?: core.$ZodNullableParams): ZodNullable<T>;
664
+ export declare function nullable<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodNullableParams): ZodNullable<T>;
665
665
  export declare function nullish<T extends core.$ZodType>(innerType: T): ZodOptional<ZodNullable<T>>;
666
666
  export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
667
667
  _zod: core.$ZodDefaultInternals<T>;
@@ -670,19 +670,19 @@ export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends Zod
670
670
  removeDefault(): T;
671
671
  }
672
672
  export declare const ZodDefault: core.$constructor<ZodDefault>;
673
- export declare function _default<T extends core.$ZodType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>), params?: core.$ZodDefaultParams): ZodDefault<T>;
673
+ export declare function _default<T extends core.$ZodType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>), params?: string | core.$ZodDefaultParams): ZodDefault<T>;
674
674
  export interface ZodNonOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
675
675
  _zod: core.$ZodNonOptionalInternals<T>;
676
676
  unwrap(): T;
677
677
  }
678
678
  export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
679
- export declare function nonoptional<T extends core.$ZodType>(innerType: T, params?: core.$ZodNonOptionalParams): ZodNonOptional<T>;
679
+ export declare function nonoptional<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T>;
680
680
  export interface ZodSuccess<T extends core.$ZodType = core.$ZodType> extends ZodType {
681
681
  _zod: core.$ZodSuccessInternals<T>;
682
682
  unwrap(): T;
683
683
  }
684
684
  export declare const ZodSuccess: core.$constructor<ZodSuccess>;
685
- export declare function success<T extends core.$ZodType>(innerType: T, params?: core.$ZodSuccessParams): ZodSuccess<T>;
685
+ export declare function success<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodSuccessParams): ZodSuccess<T>;
686
686
  export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodType {
687
687
  _zod: core.$ZodCatchInternals<T>;
688
688
  unwrap(): T;
@@ -690,7 +690,7 @@ export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodTy
690
690
  removeCatch(): T;
691
691
  }
692
692
  export declare const ZodCatch: core.$constructor<ZodCatch>;
693
- declare function _catch<T extends core.$ZodType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>), params?: core.$ZodCatchParams): ZodCatch<T>;
693
+ declare function _catch<T extends core.$ZodType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>), params?: string | core.$ZodCatchParams): ZodCatch<T>;
694
694
  export { _catch as catch };
695
695
  export interface ZodNaN extends ZodType {
696
696
  _zod: core.$ZodNaNInternals;
@@ -703,17 +703,17 @@ export interface ZodPipe<A extends core.$ZodType = core.$ZodType, B extends core
703
703
  out: B;
704
704
  }
705
705
  export declare const ZodPipe: core.$constructor<ZodPipe>;
706
- export declare function pipe<const A extends core.$ZodType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: core.$ZodPipeParams): ZodPipe<A, B>;
706
+ export declare function pipe<const A extends core.$ZodType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: string | core.$ZodPipeParams): ZodPipe<A, B>;
707
707
  export interface ZodReadonly<T extends core.$ZodType = core.$ZodType> extends ZodType {
708
708
  _zod: core.$ZodReadonlyInternals<T>;
709
709
  }
710
710
  export declare const ZodReadonly: core.$constructor<ZodReadonly>;
711
- export declare function readonly<T extends core.$ZodType>(innerType: T, params?: core.$ZodReadonlyParams): ZodReadonly<T>;
711
+ export declare function readonly<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodReadonlyParams): ZodReadonly<T>;
712
712
  export interface ZodTemplateLiteral<Template extends string = string> extends ZodType {
713
713
  _zod: core.$ZodTemplateLiteralInternals<Template>;
714
714
  }
715
715
  export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
716
- export declare function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>(parts: Parts, params?: core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
716
+ export declare function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
717
717
  export interface ZodLazy<T extends core.$ZodType = core.$ZodType> extends ZodType {
718
718
  _zod: core.$ZodLazyInternals<T>;
719
719
  unwrap(): T;
@@ -725,22 +725,22 @@ export interface ZodPromise<T extends core.$ZodType = core.$ZodType> extends Zod
725
725
  unwrap(): T;
726
726
  }
727
727
  export declare const ZodPromise: core.$constructor<ZodPromise>;
728
- export declare function promise<T extends core.$ZodType>(innerType: T, params?: core.$ZodPromiseParams): ZodPromise<T>;
728
+ export declare function promise<T extends core.$ZodType>(innerType: T, params?: string | core.$ZodPromiseParams): ZodPromise<T>;
729
729
  export interface ZodCustom<O = unknown, I = unknown> extends ZodType {
730
730
  _zod: core.$ZodCustomInternals<O, I>;
731
731
  }
732
732
  export declare const ZodCustom: core.$constructor<ZodCustom>;
733
- export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: core.$ZodCustomParams): core.$ZodCheck<O>;
733
+ export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
734
734
  export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, I>;
735
735
  export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
736
- export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>, params?: core.$ZodCustomParams): core.$ZodCheck<T>;
736
+ export declare function superRefine<T>(fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>, params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
737
737
  declare abstract class Class {
738
738
  constructor(..._args: any[]);
739
739
  }
740
740
  type ZodInstanceOfParams = util.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
741
741
  declare function _instanceof<T extends typeof Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>>;
742
742
  export { _instanceof as instanceof };
743
- export declare const stringbool: (_params?: core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
743
+ export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
744
744
  export type ZodJSONSchema = ZodUnion<[
745
745
  ZodString,
746
746
  ZodNumber,
@@ -754,7 +754,7 @@ export type ZodJSONSchema = ZodUnion<[
754
754
  output: util.JSONType;
755
755
  };
756
756
  };
757
- export declare function json(params?: core.$ZodCustomParams): ZodJSONSchema;
757
+ export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
758
758
  export interface ZodPreprocessParams extends core.$ZodTransformParams, core.$ZodPipeParams {
759
759
  }
760
760
  export declare function preprocess<A, U extends core.$ZodType>(fn: (arg: unknown, ctx: RefinementCtx) => A, schema: U, params?: ZodPreprocessParams): ZodPipe<ZodTransform<A, unknown>, U>;
@@ -19,7 +19,7 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
19
19
  ],
20
20
  });
21
21
  };
22
- inst.clone = (_def) => core.clone(inst, _def ?? def);
22
+ inst.clone = (_def) => core.clone(inst, _def);
23
23
  inst.brand = () => inst;
24
24
  inst.register = ((reg, meta) => {
25
25
  reg.add(inst, meta);
@@ -52,8 +52,8 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
52
52
  // meta
53
53
  inst.describe = (description) => {
54
54
  const cl = inst.clone();
55
- const meta = core.globalRegistry.get(inst) ?? {};
56
- meta.description = description;
55
+ const meta = { ...(core.globalRegistry.get(inst) ?? {}), description };
56
+ delete meta.id; // do not inherit
57
57
  core.globalRegistry.add(cl, meta);
58
58
  return cl;
59
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.0.0-beta.20250418T202744",
3
+ "version": "4.0.0-beta.20250424T163858",
4
4
  "type": "module",
5
5
  "author": "Colin McDonnell <zod@colinhacks.com>",
6
6
  "description": "TypeScript-first schema declaration and validation library with static type inference",
@@ -70,7 +70,7 @@
70
70
  }
71
71
  },
72
72
  "dependencies": {
73
- "@zod/core": "0.8.0"
73
+ "@zod/core": "0.9.0"
74
74
  },
75
75
  "scripts": {
76
76
  "clean": "rm -rf dist",
package/src/schemas.ts CHANGED
@@ -64,12 +64,12 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
64
64
  overwrite(fn: (x: core.output<this>) => core.output<this>): this;
65
65
 
66
66
  // wrappers
67
- optional(params?: core.$ZodOptionalParams): ZodOptional<this>;
68
- nonoptional(params?: core.$ZodNonOptionalParams): ZodNonOptional<this>;
69
- nullable(params?: core.$ZodNullableParams): ZodNullable<this>;
67
+ optional(params?: string | core.$ZodOptionalParams): ZodOptional<this>;
68
+ nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
69
+ nullable(params?: string | core.$ZodNullableParams): ZodNullable<this>;
70
70
  nullish(): ZodOptional<ZodNullable<this>>;
71
- default(def: util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
72
- default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
71
+ default(def: util.NoUndefined<core.output<this>>, params?: string | core.$ZodDefaultParams): ZodDefault<this>;
72
+ default(def: () => util.NoUndefined<core.output<this>>, params?: string | core.$ZodDefaultParams): ZodDefault<this>;
73
73
  array(): ZodArray<this>;
74
74
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
75
75
  and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
@@ -113,7 +113,7 @@ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$construct
113
113
  ],
114
114
  });
115
115
  };
116
- inst.clone = (_def) => core.clone(inst, _def ?? def);
116
+ inst.clone = (_def) => core.clone(inst, _def);
117
117
  inst.brand = () => inst as any;
118
118
  inst.register = ((reg: any, meta: any) => {
119
119
  reg.add(inst, meta);
@@ -150,8 +150,8 @@ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$construct
150
150
  // meta
151
151
  inst.describe = (description) => {
152
152
  const cl = inst.clone();
153
- const meta = core.globalRegistry.get(inst) ?? {};
154
- meta.description = description;
153
+ const meta = { ...(core.globalRegistry.get(inst) ?? {}), description };
154
+ delete meta.id; // do not inherit
155
155
  core.globalRegistry.add(cl, meta);
156
156
  return cl;
157
157
  };
@@ -259,7 +259,7 @@ export interface _ZodString<Input = unknown> extends ZodType {
259
259
  // json(params?: string | core.$ZodCheckJSONStringParams): this;
260
260
 
261
261
  // miscellaneous checks
262
- regex(regex: RegExp, params?: core.$ZodCheckRegexParams): this;
262
+ regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
263
263
  includes(value: string, params?: { message?: string; position?: number }): this;
264
264
  startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
265
265
  endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
@@ -1003,7 +1003,7 @@ export const ZodArray: core.$constructor<ZodArray> = /*@__PURE__*/ core.$constru
1003
1003
  inst.length = (len, params) => inst.check(checks.length(len, params));
1004
1004
  });
1005
1005
 
1006
- export function array<T extends core.$ZodType>(element: T, params?: core.$ZodArrayParams): ZodArray<T>;
1006
+ export function array<T extends core.$ZodType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
1007
1007
  export function array<T extends core.$ZodType>(element: core.$ZodType, params?: any): ZodArray<T> {
1008
1008
  return core._array(ZodArray, element, params) as any;
1009
1009
  }
@@ -1178,7 +1178,7 @@ export const ZodInterface: core.$constructor<ZodInterface> = /*@__PURE__*/ core.
1178
1178
 
1179
1179
  function _interface<T extends core.$ZodLooseShape>(
1180
1180
  shape: T,
1181
- params?: core.$ZodInterfaceParams,
1181
+ params?: string | core.$ZodInterfaceParams,
1182
1182
  Class: util.Constructor<ZodInterface> = ZodInterface
1183
1183
  ): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>> {
1184
1184
  const cleaned = util.cached(() => util.cleanInterfaceShape(shape));
@@ -1203,7 +1203,7 @@ export { _interface as interface };
1203
1203
 
1204
1204
  export function strictInterface<T extends core.$ZodLooseShape>(
1205
1205
  shape: T,
1206
- params?: core.$ZodInterfaceParams
1206
+ params?: string | core.$ZodInterfaceParams
1207
1207
  ): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, {}>> {
1208
1208
  const cleaned = util.cached(() => util.cleanInterfaceShape(shape));
1209
1209
  const def: core.$ZodInterfaceDef = {
@@ -1227,7 +1227,7 @@ export function strictInterface<T extends core.$ZodLooseShape>(
1227
1227
 
1228
1228
  export function looseInterface<T extends core.$ZodLooseShape>(
1229
1229
  shape: T,
1230
- params?: core.$ZodInterfaceParams
1230
+ params?: string | core.$ZodInterfaceParams
1231
1231
  ): ZodInterface<util.CleanInterfaceShape<T>, util.InitInterfaceParams<T, Record<string, unknown>>> {
1232
1232
  const cleaned = util.cached(() => util.cleanInterfaceShape(shape));
1233
1233
  const def: core.$ZodInterfaceDef = {
@@ -1350,7 +1350,7 @@ export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$const
1350
1350
  });
1351
1351
  export function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(
1352
1352
  shape?: T,
1353
- params?: core.$ZodObjectLikeParams
1353
+ params?: string | core.$ZodObjectLikeParams
1354
1354
  ): ZodObject<T, {}> {
1355
1355
  const def: core.$ZodObjectDef = {
1356
1356
  type: "object",
@@ -1365,7 +1365,10 @@ export function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(
1365
1365
 
1366
1366
  // strictObject
1367
1367
 
1368
- export function strictObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {}> {
1368
+ export function strictObject<T extends core.$ZodShape>(
1369
+ shape: T,
1370
+ params?: string | core.$ZodObjectParams
1371
+ ): ZodObject<T, {}> {
1369
1372
  return new ZodObject({
1370
1373
  type: "object",
1371
1374
  shape: shape as core.$ZodShape,
@@ -1381,7 +1384,7 @@ export function strictObject<T extends core.$ZodShape>(shape: T, params?: core.$
1381
1384
 
1382
1385
  export function looseObject<T extends core.$ZodShape>(
1383
1386
  shape: T,
1384
- params?: core.$ZodObjectParams
1387
+ params?: string | core.$ZodObjectParams
1385
1388
  ): ZodObject<T, { [k: string]: unknown }> {
1386
1389
  return new ZodObject({
1387
1390
  type: "object",
@@ -1601,7 +1604,7 @@ export const ZodUnion: core.$constructor<ZodUnion> = /*@__PURE__*/ core.$constru
1601
1604
 
1602
1605
  export function union<const T extends readonly core.$ZodType[]>(
1603
1606
  options: T,
1604
- params?: core.$ZodUnionParams
1607
+ params?: string | core.$ZodUnionParams
1605
1608
  ): ZodUnion<T> {
1606
1609
  return new ZodUnion({
1607
1610
  type: "union",
@@ -1634,11 +1637,11 @@ export interface $ZodTypeDiscriminable extends ZodType {
1634
1637
  export function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(
1635
1638
  disc: string,
1636
1639
  options: Types,
1637
- params?: core.$ZodDiscriminatedUnionParams
1640
+ params?: string | core.$ZodDiscriminatedUnionParams
1638
1641
  ): ZodDiscriminatedUnion<Types>;
1639
1642
  export function discriminatedUnion<Types extends [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(
1640
1643
  options: Types,
1641
- params?: core.$ZodDiscriminatedUnionParams
1644
+ params?: string | core.$ZodDiscriminatedUnionParams
1642
1645
  ): ZodDiscriminatedUnion<Types>;
1643
1646
  export function discriminatedUnion(...args: any[]): any {
1644
1647
  if (typeof args[0] === "string") args = args.slice(1);
@@ -1666,7 +1669,7 @@ export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/
1666
1669
  export function intersection<T extends core.$ZodType, U extends core.$ZodType>(
1667
1670
  left: T,
1668
1671
  right: U,
1669
- params?: core.$ZodIntersectionParams
1672
+ params?: string | core.$ZodIntersectionParams
1670
1673
  ): ZodIntersection<T, U> {
1671
1674
  return new ZodIntersection({
1672
1675
  type: "intersection",
@@ -1696,18 +1699,18 @@ export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constru
1696
1699
 
1697
1700
  export function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(
1698
1701
  items: T,
1699
- params?: core.$ZodTupleParams
1702
+ params?: string | core.$ZodTupleParams
1700
1703
  ): ZodTuple<T, null>;
1701
1704
  export function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(
1702
1705
  items: T,
1703
1706
  rest: Rest,
1704
- params?: core.$ZodTupleParams
1707
+ params?: string | core.$ZodTupleParams
1705
1708
  ): ZodTuple<T, Rest>;
1706
- export function tuple(items: [], params?: core.$ZodTupleParams): ZodTuple<[], null>;
1709
+ export function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
1707
1710
  export function tuple(
1708
1711
  items: core.$ZodType[],
1709
- _paramsOrRest?: core.$ZodTupleParams | core.$ZodType,
1710
- _params?: core.$ZodTupleParams
1712
+ _paramsOrRest?: string | core.$ZodTupleParams | core.$ZodType,
1713
+ _params?: string | core.$ZodTupleParams
1711
1714
  ) {
1712
1715
  const hasRest = _paramsOrRest instanceof core.$ZodType;
1713
1716
  const params = hasRest ? _params : _paramsOrRest;
@@ -1740,7 +1743,7 @@ export const ZodRecord: core.$constructor<ZodRecord> = /*@__PURE__*/ core.$const
1740
1743
  export function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(
1741
1744
  keyType: Key,
1742
1745
  valueType: Value,
1743
- params?: core.$ZodRecordParams
1746
+ params?: string | core.$ZodRecordParams
1744
1747
  ): ZodRecord<Key, Value> {
1745
1748
  return new ZodRecord({
1746
1749
  type: "record",
@@ -1753,7 +1756,7 @@ export function record<Key extends core.$ZodRecordKey, Value extends core.$ZodTy
1753
1756
  export function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(
1754
1757
  keyType: Key,
1755
1758
  valueType: Value,
1756
- params?: core.$ZodRecordParams
1759
+ params?: string | core.$ZodRecordParams
1757
1760
  ): ZodRecord<ZodUnion<[Key, ZodNever]>, Value> {
1758
1761
  return new ZodRecord({
1759
1762
  type: "record",
@@ -1781,7 +1784,7 @@ export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor
1781
1784
  export function map<Key extends core.$ZodType, Value extends core.$ZodType>(
1782
1785
  keyType: Key,
1783
1786
  valueType: Value,
1784
- params?: core.$ZodMapParams
1787
+ params?: string | core.$ZodMapParams
1785
1788
  ): ZodMap<Key, Value> {
1786
1789
  return new ZodMap({
1787
1790
  type: "map",
@@ -1794,11 +1797,11 @@ export function map<Key extends core.$ZodType, Value extends core.$ZodType>(
1794
1797
  // ZodSet
1795
1798
  export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
1796
1799
  _zod: core.$ZodSetInternals<T>;
1797
- min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
1800
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
1798
1801
  /** */
1799
- nonempty(params?: core.$ZodCheckMinSizeParams): this;
1800
- max(maxSize: number, params?: core.$ZodCheckMaxSizeParams): this;
1801
- size(size: number, params?: core.$ZodCheckSizeEqualsParams): this;
1802
+ nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
1803
+ max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
1804
+ size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
1802
1805
  }
1803
1806
  export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor("ZodSet", (inst, def) => {
1804
1807
  core.$ZodSet.init(inst, def);
@@ -1810,7 +1813,10 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor
1810
1813
  inst.size = (...args) => inst.check(core._size(...args));
1811
1814
  });
1812
1815
 
1813
- export function set<Value extends core.$ZodType>(valueType: Value, params?: core.$ZodSetParams): ZodSet<Value> {
1816
+ export function set<Value extends core.$ZodType>(
1817
+ valueType: Value,
1818
+ params?: string | core.$ZodSetParams
1819
+ ): ZodSet<Value> {
1814
1820
  return new ZodSet({
1815
1821
  type: "set",
1816
1822
  valueType,
@@ -1828,11 +1834,11 @@ export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodTyp
1828
1834
 
1829
1835
  extract<const U extends readonly (keyof T)[]>(
1830
1836
  values: U,
1831
- params?: core.$ZodEnumParams
1837
+ params?: string | core.$ZodEnumParams
1832
1838
  ): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
1833
1839
  exclude<const U extends readonly (keyof T)[]>(
1834
1840
  values: U,
1835
- params?: core.$ZodEnumParams
1841
+ params?: string | core.$ZodEnumParams
1836
1842
  ): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
1837
1843
  }
1838
1844
  export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$constructor("ZodEnum", (inst, def) => {
@@ -1877,10 +1883,10 @@ export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$construct
1877
1883
 
1878
1884
  function _enum<const T extends readonly string[]>(
1879
1885
  values: T,
1880
- params?: core.$ZodEnumParams
1886
+ params?: string | core.$ZodEnumParams
1881
1887
  ): ZodEnum<util.ToEnum<T[number]>>;
1882
- function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
1883
- function _enum(values: any, params?: core.$ZodEnumParams) {
1888
+ function _enum<const T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
1889
+ function _enum(values: any, params?: string | core.$ZodEnumParams) {
1884
1890
  const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1885
1891
 
1886
1892
  return new ZodEnum({
@@ -1898,7 +1904,7 @@ export { _enum as enum };
1898
1904
  * z.enum(Colors);
1899
1905
  * ```
1900
1906
  */
1901
- export function nativeEnum<T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T> {
1907
+ export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T> {
1902
1908
  return new ZodEnum({
1903
1909
  type: "enum",
1904
1910
  entries,
@@ -1919,9 +1925,12 @@ export const ZodLiteral: core.$constructor<ZodLiteral> = /*@__PURE__*/ core.$con
1919
1925
 
1920
1926
  export function literal<const T extends Array<util.Literal>>(
1921
1927
  value: T,
1922
- params?: core.$ZodLiteralParams
1928
+ params?: string | core.$ZodLiteralParams
1923
1929
  ): ZodLiteral<T[number]>;
1924
- export function literal<const T extends util.Literal>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T>;
1930
+ export function literal<const T extends util.Literal>(
1931
+ value: T,
1932
+ params?: string | core.$ZodLiteralParams
1933
+ ): ZodLiteral<T>;
1925
1934
  export function literal(value: any, params: any) {
1926
1935
  return new ZodLiteral({
1927
1936
  type: "literal",
@@ -1993,7 +2002,7 @@ export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.
1993
2002
 
1994
2003
  export function transform<I = unknown, O = I>(
1995
2004
  fn: (input: I, ctx: core.ParsePayload) => O,
1996
- params?: core.$ZodTransformParams
2005
+ params?: string | core.$ZodTransformParams
1997
2006
  ): ZodTransform<Awaited<O>, I> {
1998
2007
  return new ZodTransform({
1999
2008
  type: "transform",
@@ -2018,7 +2027,10 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
2018
2027
  }
2019
2028
  );
2020
2029
 
2021
- export function optional<T extends core.$ZodType>(innerType: T, params?: core.$ZodOptionalParams): ZodOptional<T> {
2030
+ export function optional<T extends core.$ZodType>(
2031
+ innerType: T,
2032
+ params?: string | core.$ZodOptionalParams
2033
+ ): ZodOptional<T> {
2022
2034
  return new ZodOptional({
2023
2035
  type: "optional",
2024
2036
  innerType,
@@ -2042,7 +2054,10 @@ export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$c
2042
2054
  }
2043
2055
  );
2044
2056
 
2045
- export function nullable<T extends core.$ZodType>(innerType: T, params?: core.$ZodNullableParams): ZodNullable<T> {
2057
+ export function nullable<T extends core.$ZodType>(
2058
+ innerType: T,
2059
+ params?: string | core.$ZodNullableParams
2060
+ ): ZodNullable<T> {
2046
2061
  return new ZodNullable({
2047
2062
  type: "nullable",
2048
2063
  innerType,
@@ -2074,7 +2089,7 @@ export const ZodDefault: core.$constructor<ZodDefault> = /*@__PURE__*/ core.$con
2074
2089
  export function _default<T extends core.$ZodType>(
2075
2090
  innerType: T,
2076
2091
  defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>),
2077
- params?: core.$ZodDefaultParams
2092
+ params?: string | core.$ZodDefaultParams
2078
2093
  ): ZodDefault<T> {
2079
2094
  return new ZodDefault({
2080
2095
  type: "default",
@@ -2102,7 +2117,7 @@ export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ c
2102
2117
 
2103
2118
  export function nonoptional<T extends core.$ZodType>(
2104
2119
  innerType: T,
2105
- params?: core.$ZodNonOptionalParams
2120
+ params?: string | core.$ZodNonOptionalParams
2106
2121
  ): ZodNonOptional<T> {
2107
2122
  return new ZodNonOptional({
2108
2123
  type: "nonoptional",
@@ -2124,7 +2139,10 @@ export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$con
2124
2139
  inst.unwrap = () => inst._zod.def.innerType;
2125
2140
  });
2126
2141
 
2127
- export function success<T extends core.$ZodType>(innerType: T, params?: core.$ZodSuccessParams): ZodSuccess<T> {
2142
+ export function success<T extends core.$ZodType>(
2143
+ innerType: T,
2144
+ params?: string | core.$ZodSuccessParams
2145
+ ): ZodSuccess<T> {
2128
2146
  return new ZodSuccess({
2129
2147
  type: "success",
2130
2148
  innerType,
@@ -2151,7 +2169,7 @@ export const ZodCatch: core.$constructor<ZodCatch> = /*@__PURE__*/ core.$constru
2151
2169
  function _catch<T extends core.$ZodType>(
2152
2170
  innerType: T,
2153
2171
  catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>),
2154
- params?: core.$ZodCatchParams
2172
+ params?: string | core.$ZodCatchParams
2155
2173
  ): ZodCatch<T> {
2156
2174
  return new ZodCatch({
2157
2175
  type: "catch",
@@ -2196,8 +2214,8 @@ export const ZodPipe: core.$constructor<ZodPipe> = /*@__PURE__*/ core.$construct
2196
2214
  export function pipe<
2197
2215
  const A extends core.$ZodType,
2198
2216
  B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
2199
- >(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: core.$ZodPipeParams): ZodPipe<A, B>;
2200
- export function pipe(in_: core.$ZodType, out: core.$ZodType, params?: core.$ZodPipeParams) {
2217
+ >(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: string | core.$ZodPipeParams): ZodPipe<A, B>;
2218
+ export function pipe(in_: core.$ZodType, out: core.$ZodType, params?: string | core.$ZodPipeParams) {
2201
2219
  return new ZodPipe({
2202
2220
  type: "pipe",
2203
2221
  in: in_,
@@ -2218,7 +2236,10 @@ export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$c
2218
2236
  }
2219
2237
  );
2220
2238
 
2221
- export function readonly<T extends core.$ZodType>(innerType: T, params?: core.$ZodReadonlyParams): ZodReadonly<T> {
2239
+ export function readonly<T extends core.$ZodType>(
2240
+ innerType: T,
2241
+ params?: string | core.$ZodReadonlyParams
2242
+ ): ZodReadonly<T> {
2222
2243
  return new ZodReadonly({
2223
2244
  type: "readonly",
2224
2245
  innerType,
@@ -2240,7 +2261,7 @@ export const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral> = /*@__PU
2240
2261
 
2241
2262
  export function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>(
2242
2263
  parts: Parts,
2243
- params?: core.$ZodTemplateLiteralParams
2264
+ params?: string | core.$ZodTemplateLiteralParams
2244
2265
  ): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>> {
2245
2266
  return new ZodTemplateLiteral({
2246
2267
  type: "template_literal",
@@ -2282,7 +2303,10 @@ export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$con
2282
2303
  inst.unwrap = () => inst._zod.def.innerType;
2283
2304
  });
2284
2305
 
2285
- export function promise<T extends core.$ZodType>(innerType: T, params?: core.$ZodPromiseParams): ZodPromise<T> {
2306
+ export function promise<T extends core.$ZodType>(
2307
+ innerType: T,
2308
+ params?: string | core.$ZodPromiseParams
2309
+ ): ZodPromise<T> {
2286
2310
  return new ZodPromise({
2287
2311
  type: "promise",
2288
2312
  innerType,
@@ -2300,7 +2324,7 @@ export const ZodCustom: core.$constructor<ZodCustom> = /*@__PURE__*/ core.$const
2300
2324
  });
2301
2325
 
2302
2326
  // custom checks
2303
- export function check<O = unknown>(fn: core.CheckFn<O>, params?: core.$ZodCustomParams): core.$ZodCheck<O> {
2327
+ export function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O> {
2304
2328
  const ch = new core.$ZodCheck({
2305
2329
  check: "custom",
2306
2330
  ...util.normalizeParams(params),
@@ -2327,7 +2351,7 @@ export function refine<T>(
2327
2351
  // superRefine
2328
2352
  export function superRefine<T>(
2329
2353
  fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>,
2330
- params?: core.$ZodCustomParams
2354
+ params?: string | core.$ZodCustomParams
2331
2355
  ): core.$ZodCheck<T> {
2332
2356
  const ch = check<T>((payload) => {
2333
2357
  (payload as RefinementCtx).addIssue = (issue) => {
@@ -2376,7 +2400,7 @@ function _instanceof<T extends typeof Class>(
2376
2400
  export { _instanceof as instanceof };
2377
2401
 
2378
2402
  // stringbool
2379
- export const stringbool: (_params?: core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean> =
2403
+ export const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean> =
2380
2404
  /*@__PURE__*/ core._stringbool.bind(null, {
2381
2405
  Pipe: ZodPipe,
2382
2406
  Boolean: ZodBoolean,
@@ -2393,7 +2417,7 @@ export type ZodJSONSchema = ZodUnion<
2393
2417
  };
2394
2418
  };
2395
2419
 
2396
- export function json(params?: core.$ZodCustomParams): ZodJSONSchema {
2420
+ export function json(params?: string | core.$ZodCustomParams): ZodJSONSchema {
2397
2421
  const jsonSchema: any = lazy(() => {
2398
2422
  return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
2399
2423
  });