zod 4.0.0-beta.20250418T073619 → 4.0.0-beta.20250420T053007

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,55 +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>;
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>;
596
597
  export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType> extends ZodType {
597
598
  _zod: core.$ZodMapInternals<Key, Value>;
598
599
  keyType: Key;
599
600
  valueType: Value;
600
601
  }
601
602
  export declare const ZodMap: core.$constructor<ZodMap>;
602
- 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>;
603
604
  export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
604
605
  _zod: core.$ZodSetInternals<T>;
605
- min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
606
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
606
607
  /** */
607
- nonempty(params?: core.$ZodCheckMinSizeParams): this;
608
- max(maxSize: number, params?: core.$ZodCheckMaxSizeParams): this;
609
- 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;
610
611
  }
611
612
  export declare const ZodSet: core.$constructor<ZodSet>;
612
- 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>;
613
614
  export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodType {
614
615
  _zod: core.$ZodEnumInternals<T>;
615
616
  enum: T;
616
617
  options: Array<T[keyof T]>;
617
- extract<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
618
- 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]>>>;
619
620
  }
620
621
  export declare const ZodEnum: core.$constructor<ZodEnum>;
621
- declare function _enum<const T extends readonly string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
622
- 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>;
623
624
  export { _enum as enum };
624
625
  /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
625
626
  *
@@ -628,14 +629,14 @@ export { _enum as enum };
628
629
  * z.enum(Colors);
629
630
  * ```
630
631
  */
631
- 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>;
632
633
  export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends ZodType {
633
634
  _zod: core.$ZodLiteralInternals<T>;
634
635
  values: Set<T>;
635
636
  }
636
637
  export declare const ZodLiteral: core.$constructor<ZodLiteral>;
637
- export declare function literal<const T extends Array<util.Literal>>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T[number]>;
638
- 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>;
639
640
  export interface ZodFile extends ZodType {
640
641
  _zod: core.$ZodFileInternals;
641
642
  min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
@@ -648,19 +649,19 @@ export interface ZodTransform<O = unknown, I = unknown> extends ZodType {
648
649
  _zod: core.$ZodTransformInternals<O, I>;
649
650
  }
650
651
  export declare const ZodTransform: core.$constructor<ZodTransform>;
651
- 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>;
652
653
  export interface ZodOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
653
654
  _zod: core.$ZodOptionalInternals<T>;
654
655
  unwrap(): T;
655
656
  }
656
657
  export declare const ZodOptional: core.$constructor<ZodOptional>;
657
- 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>;
658
659
  export interface ZodNullable<T extends core.$ZodType = core.$ZodType> extends ZodType {
659
660
  _zod: core.$ZodNullableInternals<T>;
660
661
  unwrap(): T;
661
662
  }
662
663
  export declare const ZodNullable: core.$constructor<ZodNullable>;
663
- 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>;
664
665
  export declare function nullish<T extends core.$ZodType>(innerType: T): ZodOptional<ZodNullable<T>>;
665
666
  export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
666
667
  _zod: core.$ZodDefaultInternals<T>;
@@ -669,19 +670,19 @@ export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends Zod
669
670
  removeDefault(): T;
670
671
  }
671
672
  export declare const ZodDefault: core.$constructor<ZodDefault>;
672
- 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>;
673
674
  export interface ZodNonOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
674
675
  _zod: core.$ZodNonOptionalInternals<T>;
675
676
  unwrap(): T;
676
677
  }
677
678
  export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
678
- 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>;
679
680
  export interface ZodSuccess<T extends core.$ZodType = core.$ZodType> extends ZodType {
680
681
  _zod: core.$ZodSuccessInternals<T>;
681
682
  unwrap(): T;
682
683
  }
683
684
  export declare const ZodSuccess: core.$constructor<ZodSuccess>;
684
- 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>;
685
686
  export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodType {
686
687
  _zod: core.$ZodCatchInternals<T>;
687
688
  unwrap(): T;
@@ -689,7 +690,7 @@ export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodTy
689
690
  removeCatch(): T;
690
691
  }
691
692
  export declare const ZodCatch: core.$constructor<ZodCatch>;
692
- 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>;
693
694
  export { _catch as catch };
694
695
  export interface ZodNaN extends ZodType {
695
696
  _zod: core.$ZodNaNInternals;
@@ -702,17 +703,17 @@ export interface ZodPipe<A extends core.$ZodType = core.$ZodType, B extends core
702
703
  out: B;
703
704
  }
704
705
  export declare const ZodPipe: core.$constructor<ZodPipe>;
705
- 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>;
706
707
  export interface ZodReadonly<T extends core.$ZodType = core.$ZodType> extends ZodType {
707
708
  _zod: core.$ZodReadonlyInternals<T>;
708
709
  }
709
710
  export declare const ZodReadonly: core.$constructor<ZodReadonly>;
710
- 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>;
711
712
  export interface ZodTemplateLiteral<Template extends string = string> extends ZodType {
712
713
  _zod: core.$ZodTemplateLiteralInternals<Template>;
713
714
  }
714
715
  export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
715
- 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>>;
716
717
  export interface ZodLazy<T extends core.$ZodType = core.$ZodType> extends ZodType {
717
718
  _zod: core.$ZodLazyInternals<T>;
718
719
  unwrap(): T;
@@ -724,22 +725,22 @@ export interface ZodPromise<T extends core.$ZodType = core.$ZodType> extends Zod
724
725
  unwrap(): T;
725
726
  }
726
727
  export declare const ZodPromise: core.$constructor<ZodPromise>;
727
- 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>;
728
729
  export interface ZodCustom<O = unknown, I = unknown> extends ZodType {
729
730
  _zod: core.$ZodCustomInternals<O, I>;
730
731
  }
731
732
  export declare const ZodCustom: core.$constructor<ZodCustom>;
732
- 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>;
733
734
  export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, I>;
734
735
  export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
735
- 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>;
736
737
  declare abstract class Class {
737
738
  constructor(..._args: any[]);
738
739
  }
739
740
  type ZodInstanceOfParams = util.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
740
741
  declare function _instanceof<T extends typeof Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>>;
741
742
  export { _instanceof as instanceof };
742
- export declare const stringbool: (_params?: core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
743
+ export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
743
744
  export type ZodJSONSchema = ZodUnion<[
744
745
  ZodString,
745
746
  ZodNumber,
@@ -753,7 +754,7 @@ export type ZodJSONSchema = ZodUnion<[
753
754
  output: util.JSONType;
754
755
  };
755
756
  };
756
- export declare function json(params?: core.$ZodCustomParams): ZodJSONSchema;
757
+ export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
757
758
  export interface ZodPreprocessParams extends core.$ZodTransformParams, core.$ZodPipeParams {
758
759
  }
759
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>;
@@ -85,6 +85,7 @@ exports.discriminatedUnion = discriminatedUnion;
85
85
  exports.intersection = intersection;
86
86
  exports.tuple = tuple;
87
87
  exports.record = record;
88
+ exports.partialRecord = partialRecord;
88
89
  exports.map = map;
89
90
  exports.set = set;
90
91
  exports.enum = _enum;
@@ -818,6 +819,14 @@ function record(keyType, valueType, params) {
818
819
  ...core_1.util.normalizeParams(params),
819
820
  });
820
821
  }
822
+ function partialRecord(keyType, valueType, params) {
823
+ return new exports.ZodRecord({
824
+ type: "record",
825
+ keyType: union([keyType, never()]),
826
+ valueType,
827
+ ...core_1.util.normalizeParams(params),
828
+ });
829
+ }
821
830
  exports.ZodMap = core.$constructor("ZodMap", (inst, def) => {
822
831
  core.$ZodMap.init(inst, def);
823
832
  exports.ZodType.init(inst, def);
@@ -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,55 +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>;
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>;
596
597
  export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType> extends ZodType {
597
598
  _zod: core.$ZodMapInternals<Key, Value>;
598
599
  keyType: Key;
599
600
  valueType: Value;
600
601
  }
601
602
  export declare const ZodMap: core.$constructor<ZodMap>;
602
- 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>;
603
604
  export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
604
605
  _zod: core.$ZodSetInternals<T>;
605
- min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
606
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
606
607
  /** */
607
- nonempty(params?: core.$ZodCheckMinSizeParams): this;
608
- max(maxSize: number, params?: core.$ZodCheckMaxSizeParams): this;
609
- 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;
610
611
  }
611
612
  export declare const ZodSet: core.$constructor<ZodSet>;
612
- 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>;
613
614
  export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodType {
614
615
  _zod: core.$ZodEnumInternals<T>;
615
616
  enum: T;
616
617
  options: Array<T[keyof T]>;
617
- extract<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
618
- 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]>>>;
619
620
  }
620
621
  export declare const ZodEnum: core.$constructor<ZodEnum>;
621
- declare function _enum<const T extends readonly string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
622
- 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>;
623
624
  export { _enum as enum };
624
625
  /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
625
626
  *
@@ -628,14 +629,14 @@ export { _enum as enum };
628
629
  * z.enum(Colors);
629
630
  * ```
630
631
  */
631
- 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>;
632
633
  export interface ZodLiteral<T extends util.Primitive = util.Primitive> extends ZodType {
633
634
  _zod: core.$ZodLiteralInternals<T>;
634
635
  values: Set<T>;
635
636
  }
636
637
  export declare const ZodLiteral: core.$constructor<ZodLiteral>;
637
- export declare function literal<const T extends Array<util.Literal>>(value: T, params?: core.$ZodLiteralParams): ZodLiteral<T[number]>;
638
- 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>;
639
640
  export interface ZodFile extends ZodType {
640
641
  _zod: core.$ZodFileInternals;
641
642
  min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
@@ -648,19 +649,19 @@ export interface ZodTransform<O = unknown, I = unknown> extends ZodType {
648
649
  _zod: core.$ZodTransformInternals<O, I>;
649
650
  }
650
651
  export declare const ZodTransform: core.$constructor<ZodTransform>;
651
- 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>;
652
653
  export interface ZodOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
653
654
  _zod: core.$ZodOptionalInternals<T>;
654
655
  unwrap(): T;
655
656
  }
656
657
  export declare const ZodOptional: core.$constructor<ZodOptional>;
657
- 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>;
658
659
  export interface ZodNullable<T extends core.$ZodType = core.$ZodType> extends ZodType {
659
660
  _zod: core.$ZodNullableInternals<T>;
660
661
  unwrap(): T;
661
662
  }
662
663
  export declare const ZodNullable: core.$constructor<ZodNullable>;
663
- 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>;
664
665
  export declare function nullish<T extends core.$ZodType>(innerType: T): ZodOptional<ZodNullable<T>>;
665
666
  export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
666
667
  _zod: core.$ZodDefaultInternals<T>;
@@ -669,19 +670,19 @@ export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends Zod
669
670
  removeDefault(): T;
670
671
  }
671
672
  export declare const ZodDefault: core.$constructor<ZodDefault>;
672
- 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>;
673
674
  export interface ZodNonOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
674
675
  _zod: core.$ZodNonOptionalInternals<T>;
675
676
  unwrap(): T;
676
677
  }
677
678
  export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
678
- 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>;
679
680
  export interface ZodSuccess<T extends core.$ZodType = core.$ZodType> extends ZodType {
680
681
  _zod: core.$ZodSuccessInternals<T>;
681
682
  unwrap(): T;
682
683
  }
683
684
  export declare const ZodSuccess: core.$constructor<ZodSuccess>;
684
- 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>;
685
686
  export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodType {
686
687
  _zod: core.$ZodCatchInternals<T>;
687
688
  unwrap(): T;
@@ -689,7 +690,7 @@ export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodTy
689
690
  removeCatch(): T;
690
691
  }
691
692
  export declare const ZodCatch: core.$constructor<ZodCatch>;
692
- 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>;
693
694
  export { _catch as catch };
694
695
  export interface ZodNaN extends ZodType {
695
696
  _zod: core.$ZodNaNInternals;
@@ -702,17 +703,17 @@ export interface ZodPipe<A extends core.$ZodType = core.$ZodType, B extends core
702
703
  out: B;
703
704
  }
704
705
  export declare const ZodPipe: core.$constructor<ZodPipe>;
705
- 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>;
706
707
  export interface ZodReadonly<T extends core.$ZodType = core.$ZodType> extends ZodType {
707
708
  _zod: core.$ZodReadonlyInternals<T>;
708
709
  }
709
710
  export declare const ZodReadonly: core.$constructor<ZodReadonly>;
710
- 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>;
711
712
  export interface ZodTemplateLiteral<Template extends string = string> extends ZodType {
712
713
  _zod: core.$ZodTemplateLiteralInternals<Template>;
713
714
  }
714
715
  export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
715
- 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>>;
716
717
  export interface ZodLazy<T extends core.$ZodType = core.$ZodType> extends ZodType {
717
718
  _zod: core.$ZodLazyInternals<T>;
718
719
  unwrap(): T;
@@ -724,22 +725,22 @@ export interface ZodPromise<T extends core.$ZodType = core.$ZodType> extends Zod
724
725
  unwrap(): T;
725
726
  }
726
727
  export declare const ZodPromise: core.$constructor<ZodPromise>;
727
- 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>;
728
729
  export interface ZodCustom<O = unknown, I = unknown> extends ZodType {
729
730
  _zod: core.$ZodCustomInternals<O, I>;
730
731
  }
731
732
  export declare const ZodCustom: core.$constructor<ZodCustom>;
732
- 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>;
733
734
  export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, I>;
734
735
  export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
735
- 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>;
736
737
  declare abstract class Class {
737
738
  constructor(..._args: any[]);
738
739
  }
739
740
  type ZodInstanceOfParams = util.Params<ZodCustom, core.$ZodIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
740
741
  declare function _instanceof<T extends typeof Class>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>>;
741
742
  export { _instanceof as instanceof };
742
- export declare const stringbool: (_params?: core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
743
+ export declare const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean>;
743
744
  export type ZodJSONSchema = ZodUnion<[
744
745
  ZodString,
745
746
  ZodNumber,
@@ -753,7 +754,7 @@ export type ZodJSONSchema = ZodUnion<[
753
754
  output: util.JSONType;
754
755
  };
755
756
  };
756
- export declare function json(params?: core.$ZodCustomParams): ZodJSONSchema;
757
+ export declare function json(params?: string | core.$ZodCustomParams): ZodJSONSchema;
757
758
  export interface ZodPreprocessParams extends core.$ZodTransformParams, core.$ZodPipeParams {
758
759
  }
759
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>;
@@ -708,6 +708,14 @@ export function record(keyType, valueType, params) {
708
708
  ...util.normalizeParams(params),
709
709
  });
710
710
  }
711
+ export function partialRecord(keyType, valueType, params) {
712
+ return new ZodRecord({
713
+ type: "record",
714
+ keyType: union([keyType, never()]),
715
+ valueType,
716
+ ...util.normalizeParams(params),
717
+ });
718
+ }
711
719
  export const ZodMap = /*@__PURE__*/ core.$constructor("ZodMap", (inst, def) => {
712
720
  core.$ZodMap.init(inst, def);
713
721
  ZodType.init(inst, def);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.0.0-beta.20250418T073619",
3
+ "version": "4.0.0-beta.20250420T053007",
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.7.1"
73
+ "@zod/core": "0.8.1"
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>;
@@ -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",
@@ -1750,6 +1753,19 @@ export function record<Key extends core.$ZodRecordKey, Value extends core.$ZodTy
1750
1753
  }) as ZodRecord<Key, Value>;
1751
1754
  }
1752
1755
 
1756
+ export function partialRecord<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(
1757
+ keyType: Key,
1758
+ valueType: Value,
1759
+ params?: string | core.$ZodRecordParams
1760
+ ): ZodRecord<ZodUnion<[Key, ZodNever]>, Value> {
1761
+ return new ZodRecord({
1762
+ type: "record",
1763
+ keyType: union([keyType, never()]),
1764
+ valueType,
1765
+ ...util.normalizeParams(params),
1766
+ }) as ZodRecord<ZodUnion<[Key, ZodNever]>, Value>;
1767
+ }
1768
+
1753
1769
  // ZodMap
1754
1770
  export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType>
1755
1771
  extends ZodType {
@@ -1768,7 +1784,7 @@ export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor
1768
1784
  export function map<Key extends core.$ZodType, Value extends core.$ZodType>(
1769
1785
  keyType: Key,
1770
1786
  valueType: Value,
1771
- params?: core.$ZodMapParams
1787
+ params?: string | core.$ZodMapParams
1772
1788
  ): ZodMap<Key, Value> {
1773
1789
  return new ZodMap({
1774
1790
  type: "map",
@@ -1781,11 +1797,11 @@ export function map<Key extends core.$ZodType, Value extends core.$ZodType>(
1781
1797
  // ZodSet
1782
1798
  export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
1783
1799
  _zod: core.$ZodSetInternals<T>;
1784
- min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
1800
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
1785
1801
  /** */
1786
- nonempty(params?: core.$ZodCheckMinSizeParams): this;
1787
- max(maxSize: number, params?: core.$ZodCheckMaxSizeParams): this;
1788
- 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;
1789
1805
  }
1790
1806
  export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor("ZodSet", (inst, def) => {
1791
1807
  core.$ZodSet.init(inst, def);
@@ -1797,7 +1813,10 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor
1797
1813
  inst.size = (...args) => inst.check(core._size(...args));
1798
1814
  });
1799
1815
 
1800
- 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> {
1801
1820
  return new ZodSet({
1802
1821
  type: "set",
1803
1822
  valueType,
@@ -1815,11 +1834,11 @@ export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodTyp
1815
1834
 
1816
1835
  extract<const U extends readonly (keyof T)[]>(
1817
1836
  values: U,
1818
- params?: core.$ZodEnumParams
1837
+ params?: string | core.$ZodEnumParams
1819
1838
  ): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
1820
1839
  exclude<const U extends readonly (keyof T)[]>(
1821
1840
  values: U,
1822
- params?: core.$ZodEnumParams
1841
+ params?: string | core.$ZodEnumParams
1823
1842
  ): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
1824
1843
  }
1825
1844
  export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$constructor("ZodEnum", (inst, def) => {
@@ -1864,10 +1883,10 @@ export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$construct
1864
1883
 
1865
1884
  function _enum<const T extends readonly string[]>(
1866
1885
  values: T,
1867
- params?: core.$ZodEnumParams
1886
+ params?: string | core.$ZodEnumParams
1868
1887
  ): ZodEnum<util.ToEnum<T[number]>>;
1869
- function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
1870
- 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) {
1871
1890
  const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1872
1891
 
1873
1892
  return new ZodEnum({
@@ -1885,7 +1904,7 @@ export { _enum as enum };
1885
1904
  * z.enum(Colors);
1886
1905
  * ```
1887
1906
  */
1888
- 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> {
1889
1908
  return new ZodEnum({
1890
1909
  type: "enum",
1891
1910
  entries,
@@ -1906,9 +1925,12 @@ export const ZodLiteral: core.$constructor<ZodLiteral> = /*@__PURE__*/ core.$con
1906
1925
 
1907
1926
  export function literal<const T extends Array<util.Literal>>(
1908
1927
  value: T,
1909
- params?: core.$ZodLiteralParams
1928
+ params?: string | core.$ZodLiteralParams
1910
1929
  ): ZodLiteral<T[number]>;
1911
- 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>;
1912
1934
  export function literal(value: any, params: any) {
1913
1935
  return new ZodLiteral({
1914
1936
  type: "literal",
@@ -1980,7 +2002,7 @@ export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.
1980
2002
 
1981
2003
  export function transform<I = unknown, O = I>(
1982
2004
  fn: (input: I, ctx: core.ParsePayload) => O,
1983
- params?: core.$ZodTransformParams
2005
+ params?: string | core.$ZodTransformParams
1984
2006
  ): ZodTransform<Awaited<O>, I> {
1985
2007
  return new ZodTransform({
1986
2008
  type: "transform",
@@ -2005,7 +2027,10 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
2005
2027
  }
2006
2028
  );
2007
2029
 
2008
- 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> {
2009
2034
  return new ZodOptional({
2010
2035
  type: "optional",
2011
2036
  innerType,
@@ -2029,7 +2054,10 @@ export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$c
2029
2054
  }
2030
2055
  );
2031
2056
 
2032
- 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> {
2033
2061
  return new ZodNullable({
2034
2062
  type: "nullable",
2035
2063
  innerType,
@@ -2061,7 +2089,7 @@ export const ZodDefault: core.$constructor<ZodDefault> = /*@__PURE__*/ core.$con
2061
2089
  export function _default<T extends core.$ZodType>(
2062
2090
  innerType: T,
2063
2091
  defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>),
2064
- params?: core.$ZodDefaultParams
2092
+ params?: string | core.$ZodDefaultParams
2065
2093
  ): ZodDefault<T> {
2066
2094
  return new ZodDefault({
2067
2095
  type: "default",
@@ -2089,7 +2117,7 @@ export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ c
2089
2117
 
2090
2118
  export function nonoptional<T extends core.$ZodType>(
2091
2119
  innerType: T,
2092
- params?: core.$ZodNonOptionalParams
2120
+ params?: string | core.$ZodNonOptionalParams
2093
2121
  ): ZodNonOptional<T> {
2094
2122
  return new ZodNonOptional({
2095
2123
  type: "nonoptional",
@@ -2111,7 +2139,10 @@ export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$con
2111
2139
  inst.unwrap = () => inst._zod.def.innerType;
2112
2140
  });
2113
2141
 
2114
- 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> {
2115
2146
  return new ZodSuccess({
2116
2147
  type: "success",
2117
2148
  innerType,
@@ -2138,7 +2169,7 @@ export const ZodCatch: core.$constructor<ZodCatch> = /*@__PURE__*/ core.$constru
2138
2169
  function _catch<T extends core.$ZodType>(
2139
2170
  innerType: T,
2140
2171
  catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>),
2141
- params?: core.$ZodCatchParams
2172
+ params?: string | core.$ZodCatchParams
2142
2173
  ): ZodCatch<T> {
2143
2174
  return new ZodCatch({
2144
2175
  type: "catch",
@@ -2183,8 +2214,8 @@ export const ZodPipe: core.$constructor<ZodPipe> = /*@__PURE__*/ core.$construct
2183
2214
  export function pipe<
2184
2215
  const A extends core.$ZodType,
2185
2216
  B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
2186
- >(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: core.$ZodPipeParams): ZodPipe<A, B>;
2187
- 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) {
2188
2219
  return new ZodPipe({
2189
2220
  type: "pipe",
2190
2221
  in: in_,
@@ -2205,7 +2236,10 @@ export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$c
2205
2236
  }
2206
2237
  );
2207
2238
 
2208
- 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> {
2209
2243
  return new ZodReadonly({
2210
2244
  type: "readonly",
2211
2245
  innerType,
@@ -2227,7 +2261,7 @@ export const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral> = /*@__PU
2227
2261
 
2228
2262
  export function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>(
2229
2263
  parts: Parts,
2230
- params?: core.$ZodTemplateLiteralParams
2264
+ params?: string | core.$ZodTemplateLiteralParams
2231
2265
  ): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>> {
2232
2266
  return new ZodTemplateLiteral({
2233
2267
  type: "template_literal",
@@ -2269,7 +2303,10 @@ export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$con
2269
2303
  inst.unwrap = () => inst._zod.def.innerType;
2270
2304
  });
2271
2305
 
2272
- 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> {
2273
2310
  return new ZodPromise({
2274
2311
  type: "promise",
2275
2312
  innerType,
@@ -2287,7 +2324,7 @@ export const ZodCustom: core.$constructor<ZodCustom> = /*@__PURE__*/ core.$const
2287
2324
  });
2288
2325
 
2289
2326
  // custom checks
2290
- 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> {
2291
2328
  const ch = new core.$ZodCheck({
2292
2329
  check: "custom",
2293
2330
  ...util.normalizeParams(params),
@@ -2314,7 +2351,7 @@ export function refine<T>(
2314
2351
  // superRefine
2315
2352
  export function superRefine<T>(
2316
2353
  fn: (arg: T, payload: RefinementCtx<T>) => void | Promise<void>,
2317
- params?: core.$ZodCustomParams
2354
+ params?: string | core.$ZodCustomParams
2318
2355
  ): core.$ZodCheck<T> {
2319
2356
  const ch = check<T>((payload) => {
2320
2357
  (payload as RefinementCtx).addIssue = (issue) => {
@@ -2363,7 +2400,7 @@ function _instanceof<T extends typeof Class>(
2363
2400
  export { _instanceof as instanceof };
2364
2401
 
2365
2402
  // stringbool
2366
- export const stringbool: (_params?: core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean> =
2403
+ export const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodPipe<ZodUnknown, ZodBoolean> =
2367
2404
  /*@__PURE__*/ core._stringbool.bind(null, {
2368
2405
  Pipe: ZodPipe,
2369
2406
  Boolean: ZodBoolean,
@@ -2380,7 +2417,7 @@ export type ZodJSONSchema = ZodUnion<
2380
2417
  };
2381
2418
  };
2382
2419
 
2383
- export function json(params?: core.$ZodCustomParams): ZodJSONSchema {
2420
+ export function json(params?: string | core.$ZodCustomParams): ZodJSONSchema {
2384
2421
  const jsonSchema: any = lazy(() => {
2385
2422
  return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
2386
2423
  });