zod 4.0.0-beta.20250411T005215 → 4.0.0-beta.20250411T195319

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.
@@ -45,3 +45,4 @@ ZodType as ZodTypeAny,
45
45
  ZodType as ZodSchema,
46
46
  /** @deprecated Use `z.ZodType` */
47
47
  ZodType as Schema, };
48
+ export type ZodRawShape = core.$ZodShape;
@@ -11,6 +11,10 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
11
11
  def: this["_zod"]["def"];
12
12
  /** @deprecated Use `.def` instead. */
13
13
  _def: this["_zod"]["def"];
14
+ /** @deprecated Use `z.output<typeof schema>` instead. */
15
+ _output: this["_zod"]["output"];
16
+ /** @deprecated Use `z.input<typeof schema>` instead. */
17
+ _input: this["_zod"]["input"];
14
18
  check(...checks: (core.CheckFn<this["_zod"]["output"]> | core.$ZodCheck<this["_zod"]["output"]>)[]): this;
15
19
  clone(def?: this["_zod"]["def"]): this;
16
20
  register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$ZodRegistry<R["_meta"], this>["_meta"]?] : [core.$ZodRegistry<R["_meta"], this>["_meta"]] : ["Incompatible schema"]): this;
@@ -32,6 +36,7 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
32
36
  default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
33
37
  array(): ZodArray<this>;
34
38
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
39
+ and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
35
40
  transform<NewOut>(transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
36
41
  catch(def: core.output<this>): ZodCatch<this>;
37
42
  catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
@@ -386,23 +391,23 @@ export interface ZodObjectLike<out O = object, out I = object> extends ZodType {
386
391
  _zod: core.$ZodObjectLikeInternals<O, I>;
387
392
  }
388
393
  export declare const ZodObjectLike: core.$constructor<ZodObjectLike>;
389
- export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["shape"]>;
394
+ export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["def"]["shape"]>;
390
395
  export declare function keyof<T extends ZodInterface>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
391
- type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
392
- [k in Keys]: ZodOptional<T["_zod"]["shape"][k]>;
396
+ type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
397
+ [k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
393
398
  }>, {
394
399
  optional: T["_zod"]["optional"] | (string & Keys);
395
400
  defaulted: T["_zod"]["defaulted"];
396
401
  extra: T["_zod"]["extra"];
397
402
  }>;
398
- type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
399
- [k in Keys]: ZodNonOptional<T["_zod"]["shape"][k]>;
403
+ type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
404
+ [k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
400
405
  }>, {
401
406
  optional: never;
402
407
  defaulted: T["_zod"]["defaulted"];
403
408
  extra: T["_zod"]["extra"];
404
409
  }>;
405
- type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.ExtendShape<A["_zod"]["shape"], B["_zod"]["shape"]>, util.MergeInterfaceParams<A, B>>;
410
+ type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.ExtendShape<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<A, B>>;
406
411
  export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodLooseShape, out Params extends core.$ZodInterfaceNamedParams = core.$ZodInterfaceNamedParams> extends ZodType {
407
412
  _zod: core.$ZodInterfaceInternals<Shape, Params>;
408
413
  keyof(): ZodEnum<util.ToEnum<util.InterfaceKeys<string & keyof Shape>>>;
@@ -463,7 +468,7 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
463
468
  strict(): ZodObject<Shape, {}>;
464
469
  /** @deprecated This is the default behavior. This method call is likely unnecessary. */
465
470
  strip(): ZodObject<Shape, {}>;
466
- extend<U extends ZodObject>(shape: U): ZodObject<util.ExtendShape<Shape, U["_zod"]["shape"]>, Extra>;
471
+ extend<const U extends ZodObject>(schema: U): ZodObject<util.ExtendShape<Shape, U["_zod"]["def"]["shape"]>, Extra>;
467
472
  extend<U extends core.$ZodShape>(shape: U): ZodObject<util.ExtendShape<Shape, U>, Extra>;
468
473
  /** @deprecated Use `A.extend(B)` */
469
474
  merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Overwrite<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
@@ -488,56 +493,56 @@ export declare function strictObject<T extends core.$ZodShape>(shape: T, params?
488
493
  export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {
489
494
  [k: string]: unknown;
490
495
  }>;
491
- export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>, util.MergeInterfaceParams<T, U>>;
492
- export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.ExtendObject<T["_zod"]["shape"], U["_zod"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
493
- export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
494
- export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>, {
496
+ export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
497
+ export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
498
+ export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
499
+ export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, {
495
500
  extra: T["_zod"]["extra"] & U["_zod"]["extra"];
496
- optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["shape"]> | U["_zod"]["optional"];
497
- defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["shape"]> | U["_zod"]["defaulted"];
498
- }> : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
499
- export declare function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>, {
501
+ optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
502
+ defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
503
+ }> : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
504
+ export declare function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>, {
500
505
  optional: Extract<T["_zod"]["optional"], keyof M>;
501
506
  defaulted: Extract<T["_zod"]["defaulted"], keyof M>;
502
507
  extra: T["_zod"]["extra"];
503
- }> : ZodObject<util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>, T["_zod"]["extra"]>;
504
- export declare function omit<T extends ZodObjectLike, const M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Omit<T["_zod"]["shape"], keyof M>>, {
508
+ }> : ZodObject<util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>, T["_zod"]["extra"]>;
509
+ export declare function omit<T extends ZodObjectLike, const M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>, {
505
510
  optional: Exclude<T["_zod"]["optional"], keyof M>;
506
511
  defaulted: Exclude<T["_zod"]["defaulted"], keyof M>;
507
512
  extra: T["_zod"]["extra"];
508
- }> : ZodObject<util.Flatten<Omit<T["_zod"]["shape"], keyof M>>, T["_zod"]["extra"]>;
513
+ }> : ZodObject<util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>, T["_zod"]["extra"]>;
509
514
  export declare function partial<T extends ZodObjectLike>(schema: T): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<{
510
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
515
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
511
516
  }, {
512
- optional: string & keyof T["_zod"]["shape"];
517
+ optional: string & keyof T["_zod"]["def"]["shape"];
513
518
  defaulted: never;
514
519
  extra: T["_zod"]["extra"];
515
520
  }> : ZodObject<{
516
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
521
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
517
522
  }, T["_zod"]["extra"]>;
518
- export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
519
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
523
+ export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
524
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
520
525
  }>, {
521
526
  optional: string & (T["_zod"]["optional"] | keyof M);
522
527
  defaulted: T["_zod"]["defaulted"];
523
528
  extra: T["_zod"]["extra"];
524
529
  }> : ZodObject<{
525
- [k in keyof T["_zod"]["shape"]]: k extends keyof M ? ZodOptional<T["_zod"]["shape"][k]> : T["_zod"]["shape"][k];
530
+ [k in keyof T["_zod"]["def"]["shape"]]: k extends keyof M ? ZodOptional<T["_zod"]["def"]["shape"][k]> : T["_zod"]["def"]["shape"][k];
526
531
  }, T["_zod"]["extra"]>;
527
532
  export declare function required<T extends {
528
533
  _subtype: "object";
529
534
  } & ZodObject>(schema: T): ZodObject<{
530
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
535
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
531
536
  }>;
532
537
  export declare function required<T extends {
533
538
  _subtype: "object";
534
- } & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.ExtendShape<T["_zod"]["shape"], {
535
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
539
+ } & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.ExtendShape<T["_zod"]["def"]["shape"], {
540
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
536
541
  }>>;
537
542
  export declare function required<T extends {
538
543
  _subtype: "interface";
539
544
  } & ZodInterface>(schema: T): ZodInterface<{
540
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
545
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
541
546
  }, {
542
547
  optional: never;
543
548
  defaulted: T["_zod"]["defaulted"];
@@ -545,8 +550,8 @@ export declare function required<T extends {
545
550
  }>;
546
551
  export declare function required<T extends {
547
552
  _subtype: "interface";
548
- } & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
549
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
553
+ } & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
554
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
550
555
  }>, {
551
556
  optional: Exclude<T["_zod"]["optional"], keyof M>;
552
557
  defaulted: T["_zod"]["defaulted"];
@@ -615,8 +620,8 @@ export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodTyp
615
620
  exclude<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
616
621
  }
617
622
  export declare const ZodEnum: core.$constructor<ZodEnum>;
618
- declare function _enum<const T extends string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
619
- declare function _enum<T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
623
+ declare function _enum<const T extends readonly string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
624
+ declare function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
620
625
  export { _enum as enum };
621
626
  /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
622
627
  *
@@ -166,7 +166,7 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
166
166
  inst.nonoptional = (params) => nonoptional(inst, params);
167
167
  inst.array = () => array(inst);
168
168
  inst.or = (arg) => union([inst, arg]);
169
- // inst.and = (arg) => intersection(inst, arg);
169
+ inst.and = (arg) => intersection(inst, arg);
170
170
  inst.transform = (tx) => pipe(inst, transform(tx));
171
171
  inst.default = (def, params) => _default(inst, def, params);
172
172
  // inst.coalesce = (def, params) => coalesce(inst, def, params);
@@ -602,7 +602,7 @@ function keyof(schema) {
602
602
  exports.ZodInterface = core.$constructor("ZodInterface", (inst, def) => {
603
603
  core.$ZodInterface.init(inst, def);
604
604
  exports.ZodType.init(inst, def);
605
- core_1.util.defineLazy(inst._zod, "shape", () => def.shape);
605
+ // util.defineLazy(inst._zod, "shape", () => def.shape);
606
606
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
607
607
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
608
608
  inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
@@ -45,3 +45,4 @@ ZodType as ZodTypeAny,
45
45
  ZodType as ZodSchema,
46
46
  /** @deprecated Use `z.ZodType` */
47
47
  ZodType as Schema, };
48
+ export type ZodRawShape = core.$ZodShape;
@@ -11,6 +11,10 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
11
11
  def: this["_zod"]["def"];
12
12
  /** @deprecated Use `.def` instead. */
13
13
  _def: this["_zod"]["def"];
14
+ /** @deprecated Use `z.output<typeof schema>` instead. */
15
+ _output: this["_zod"]["output"];
16
+ /** @deprecated Use `z.input<typeof schema>` instead. */
17
+ _input: this["_zod"]["input"];
14
18
  check(...checks: (core.CheckFn<this["_zod"]["output"]> | core.$ZodCheck<this["_zod"]["output"]>)[]): this;
15
19
  clone(def?: this["_zod"]["def"]): this;
16
20
  register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$ZodRegistry<R["_meta"], this>["_meta"]?] : [core.$ZodRegistry<R["_meta"], this>["_meta"]] : ["Incompatible schema"]): this;
@@ -32,6 +36,7 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
32
36
  default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
33
37
  array(): ZodArray<this>;
34
38
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
39
+ and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
35
40
  transform<NewOut>(transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
36
41
  catch(def: core.output<this>): ZodCatch<this>;
37
42
  catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
@@ -386,23 +391,23 @@ export interface ZodObjectLike<out O = object, out I = object> extends ZodType {
386
391
  _zod: core.$ZodObjectLikeInternals<O, I>;
387
392
  }
388
393
  export declare const ZodObjectLike: core.$constructor<ZodObjectLike>;
389
- export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["shape"]>;
394
+ export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["def"]["shape"]>;
390
395
  export declare function keyof<T extends ZodInterface>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
391
- type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
392
- [k in Keys]: ZodOptional<T["_zod"]["shape"][k]>;
396
+ type ZodInterfacePartial<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
397
+ [k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
393
398
  }>, {
394
399
  optional: T["_zod"]["optional"] | (string & Keys);
395
400
  defaulted: T["_zod"]["defaulted"];
396
401
  extra: T["_zod"]["extra"];
397
402
  }>;
398
- type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
399
- [k in Keys]: ZodNonOptional<T["_zod"]["shape"][k]>;
403
+ type ZodInterfaceRequired<T extends ZodInterface, Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"]> = ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
404
+ [k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
400
405
  }>, {
401
406
  optional: never;
402
407
  defaulted: T["_zod"]["defaulted"];
403
408
  extra: T["_zod"]["extra"];
404
409
  }>;
405
- type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.ExtendShape<A["_zod"]["shape"], B["_zod"]["shape"]>, util.MergeInterfaceParams<A, B>>;
410
+ type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<util.ExtendShape<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<A, B>>;
406
411
  export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodLooseShape, out Params extends core.$ZodInterfaceNamedParams = core.$ZodInterfaceNamedParams> extends ZodType {
407
412
  _zod: core.$ZodInterfaceInternals<Shape, Params>;
408
413
  keyof(): ZodEnum<util.ToEnum<util.InterfaceKeys<string & keyof Shape>>>;
@@ -463,7 +468,7 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
463
468
  strict(): ZodObject<Shape, {}>;
464
469
  /** @deprecated This is the default behavior. This method call is likely unnecessary. */
465
470
  strip(): ZodObject<Shape, {}>;
466
- extend<U extends ZodObject>(shape: U): ZodObject<util.ExtendShape<Shape, U["_zod"]["shape"]>, Extra>;
471
+ extend<const U extends ZodObject>(schema: U): ZodObject<util.ExtendShape<Shape, U["_zod"]["def"]["shape"]>, Extra>;
467
472
  extend<U extends core.$ZodShape>(shape: U): ZodObject<util.ExtendShape<Shape, U>, Extra>;
468
473
  /** @deprecated Use `A.extend(B)` */
469
474
  merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Overwrite<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
@@ -488,56 +493,56 @@ export declare function strictObject<T extends core.$ZodShape>(shape: T, params?
488
493
  export declare function looseObject<T extends core.$ZodShape>(shape: T, params?: core.$ZodObjectParams): ZodObject<T, {
489
494
  [k: string]: unknown;
490
495
  }>;
491
- export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>, util.MergeInterfaceParams<T, U>>;
492
- export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.ExtendObject<T["_zod"]["shape"], U["_zod"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
493
- export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
494
- export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>, {
496
+ export declare function extend<T extends ZodInterface, U extends ZodInterface>(a: T, b: U): ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, util.MergeInterfaceParams<T, U>>;
497
+ export declare function extend<T extends ZodObject, U extends ZodObject>(a: T, b: U): ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
498
+ export declare function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T extends ZodInterface<infer TShape, infer TParams> ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>> : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
499
+ export declare function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(schema: T, shape: U): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>, {
495
500
  extra: T["_zod"]["extra"] & U["_zod"]["extra"];
496
- optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["shape"]> | U["_zod"]["optional"];
497
- defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["shape"]> | U["_zod"]["defaulted"];
498
- }> : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
499
- export declare function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>, {
501
+ optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
502
+ defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
503
+ }> : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
504
+ export declare function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>, {
500
505
  optional: Extract<T["_zod"]["optional"], keyof M>;
501
506
  defaulted: Extract<T["_zod"]["defaulted"], keyof M>;
502
507
  extra: T["_zod"]["extra"];
503
- }> : ZodObject<util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>, T["_zod"]["extra"]>;
504
- export declare function omit<T extends ZodObjectLike, const M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Omit<T["_zod"]["shape"], keyof M>>, {
508
+ }> : ZodObject<util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>, T["_zod"]["extra"]>;
509
+ export declare function omit<T extends ZodObjectLike, const M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>, {
505
510
  optional: Exclude<T["_zod"]["optional"], keyof M>;
506
511
  defaulted: Exclude<T["_zod"]["defaulted"], keyof M>;
507
512
  extra: T["_zod"]["extra"];
508
- }> : ZodObject<util.Flatten<Omit<T["_zod"]["shape"], keyof M>>, T["_zod"]["extra"]>;
513
+ }> : ZodObject<util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>, T["_zod"]["extra"]>;
509
514
  export declare function partial<T extends ZodObjectLike>(schema: T): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<{
510
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
515
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
511
516
  }, {
512
- optional: string & keyof T["_zod"]["shape"];
517
+ optional: string & keyof T["_zod"]["def"]["shape"];
513
518
  defaulted: never;
514
519
  extra: T["_zod"]["extra"];
515
520
  }> : ZodObject<{
516
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
521
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
517
522
  }, T["_zod"]["extra"]>;
518
- export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
519
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
523
+ export declare function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): T["_zod"]["def"]["type"] extends "interface" ? ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
524
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
520
525
  }>, {
521
526
  optional: string & (T["_zod"]["optional"] | keyof M);
522
527
  defaulted: T["_zod"]["defaulted"];
523
528
  extra: T["_zod"]["extra"];
524
529
  }> : ZodObject<{
525
- [k in keyof T["_zod"]["shape"]]: k extends keyof M ? ZodOptional<T["_zod"]["shape"][k]> : T["_zod"]["shape"][k];
530
+ [k in keyof T["_zod"]["def"]["shape"]]: k extends keyof M ? ZodOptional<T["_zod"]["def"]["shape"][k]> : T["_zod"]["def"]["shape"][k];
526
531
  }, T["_zod"]["extra"]>;
527
532
  export declare function required<T extends {
528
533
  _subtype: "object";
529
534
  } & ZodObject>(schema: T): ZodObject<{
530
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
535
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
531
536
  }>;
532
537
  export declare function required<T extends {
533
538
  _subtype: "object";
534
- } & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.ExtendShape<T["_zod"]["shape"], {
535
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
539
+ } & ZodObject, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(schema: T, mask: M): ZodObject<util.ExtendShape<T["_zod"]["def"]["shape"], {
540
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
536
541
  }>>;
537
542
  export declare function required<T extends {
538
543
  _subtype: "interface";
539
544
  } & ZodInterface>(schema: T): ZodInterface<{
540
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
545
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
541
546
  }, {
542
547
  optional: never;
543
548
  defaulted: T["_zod"]["defaulted"];
@@ -545,8 +550,8 @@ export declare function required<T extends {
545
550
  }>;
546
551
  export declare function required<T extends {
547
552
  _subtype: "interface";
548
- } & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.ExtendShape<T["_zod"]["shape"], {
549
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
553
+ } & ZodInterface, M extends util.Mask<keyof T["_zod"]["output"]>>(schema: T, mask: M): ZodInterface<util.ExtendShape<T["_zod"]["def"]["shape"], {
554
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
550
555
  }>, {
551
556
  optional: Exclude<T["_zod"]["optional"], keyof M>;
552
557
  defaulted: T["_zod"]["defaulted"];
@@ -615,8 +620,8 @@ export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends ZodTyp
615
620
  exclude<const U extends readonly (keyof T)[]>(values: U, params?: core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
616
621
  }
617
622
  export declare const ZodEnum: core.$constructor<ZodEnum>;
618
- declare function _enum<const T extends string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
619
- declare function _enum<T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
623
+ declare function _enum<const T extends readonly string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
624
+ declare function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
620
625
  export { _enum as enum };
621
626
  /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
622
627
  *
@@ -42,7 +42,7 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
42
42
  inst.nonoptional = (params) => nonoptional(inst, params);
43
43
  inst.array = () => array(inst);
44
44
  inst.or = (arg) => union([inst, arg]);
45
- // inst.and = (arg) => intersection(inst, arg);
45
+ inst.and = (arg) => intersection(inst, arg);
46
46
  inst.transform = (tx) => pipe(inst, transform(tx));
47
47
  inst.default = (def, params) => _default(inst, def, params);
48
48
  // inst.coalesce = (def, params) => coalesce(inst, def, params);
@@ -481,7 +481,7 @@ export function keyof(schema) {
481
481
  export const ZodInterface = /*@__PURE__*/ core.$constructor("ZodInterface", (inst, def) => {
482
482
  core.$ZodInterface.init(inst, def);
483
483
  ZodType.init(inst, def);
484
- util.defineLazy(inst._zod, "shape", () => def.shape);
484
+ // util.defineLazy(inst._zod, "shape", () => def.shape);
485
485
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
486
486
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
487
487
  inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.0.0-beta.20250411T005215",
3
+ "version": "4.0.0-beta.20250411T195319",
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.3.3"
73
+ "@zod/core": "0.4.0"
74
74
  },
75
75
  "scripts": {
76
76
  "clean": "rm -rf dist",
package/src/compat.ts CHANGED
@@ -72,3 +72,5 @@ export type {
72
72
  /** @deprecated Use `z.ZodType` */
73
73
  ZodType as Schema,
74
74
  };
75
+
76
+ export type ZodRawShape = core.$ZodShape;
package/src/schemas.ts CHANGED
@@ -25,6 +25,10 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
25
25
  def: this["_zod"]["def"];
26
26
  /** @deprecated Use `.def` instead. */
27
27
  _def: this["_zod"]["def"];
28
+ /** @deprecated Use `z.output<typeof schema>` instead. */
29
+ _output: this["_zod"]["output"];
30
+ /** @deprecated Use `z.input<typeof schema>` instead. */
31
+ _input: this["_zod"]["input"];
28
32
  // base methods
29
33
  check(...checks: (core.CheckFn<this["_zod"]["output"]> | core.$ZodCheck<this["_zod"]["output"]>)[]): this;
30
34
  clone(def?: this["_zod"]["def"]): this;
@@ -70,7 +74,7 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
70
74
  default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
71
75
  array(): ZodArray<this>;
72
76
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
73
- // and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
77
+ and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
74
78
  transform<NewOut>(
75
79
  transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>
76
80
  ): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
@@ -135,7 +139,7 @@ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$construct
135
139
  inst.nonoptional = (params) => nonoptional(inst, params);
136
140
  inst.array = () => array(inst);
137
141
  inst.or = (arg) => union([inst, arg]);
138
- // inst.and = (arg) => intersection(inst, arg);
142
+ inst.and = (arg) => intersection(inst, arg);
139
143
  inst.transform = (tx) => pipe(inst, transform(tx as any)) as never;
140
144
  inst.default = (def, params) => _default(inst, def, params);
141
145
  // inst.coalesce = (def, params) => coalesce(inst, def, params);
@@ -1017,7 +1021,7 @@ export const ZodObjectLike: core.$constructor<ZodObjectLike> = /*@__PURE__*/ cor
1017
1021
  );
1018
1022
 
1019
1023
  // .keyof
1020
- export function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["shape"]>;
1024
+ export function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["def"]["shape"]>;
1021
1025
  export function keyof<T extends ZodInterface>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
1022
1026
  export function keyof(schema: ZodObjectLike) {
1023
1027
  const shape =
@@ -1031,12 +1035,12 @@ export function keyof(schema: ZodObjectLike) {
1031
1035
  // ZodInterface
1032
1036
  type ZodInterfacePartial<
1033
1037
  T extends ZodInterface,
1034
- Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"],
1038
+ Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"],
1035
1039
  > = ZodInterface<
1036
1040
  util.ExtendShape<
1037
- T["_zod"]["shape"],
1041
+ T["_zod"]["def"]["shape"],
1038
1042
  {
1039
- [k in Keys]: ZodOptional<T["_zod"]["shape"][k]>;
1043
+ [k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1040
1044
  }
1041
1045
  >,
1042
1046
  {
@@ -1048,12 +1052,12 @@ type ZodInterfacePartial<
1048
1052
 
1049
1053
  type ZodInterfaceRequired<
1050
1054
  T extends ZodInterface,
1051
- Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"],
1055
+ Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"],
1052
1056
  > = ZodInterface<
1053
1057
  util.ExtendShape<
1054
- T["_zod"]["shape"],
1058
+ T["_zod"]["def"]["shape"],
1055
1059
  {
1056
- [k in Keys]: ZodNonOptional<T["_zod"]["shape"][k]>;
1060
+ [k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1057
1061
  }
1058
1062
  >,
1059
1063
  {
@@ -1064,7 +1068,7 @@ type ZodInterfaceRequired<
1064
1068
  >;
1065
1069
 
1066
1070
  type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<
1067
- util.ExtendShape<A["_zod"]["shape"], B["_zod"]["shape"]>,
1071
+ util.ExtendShape<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>,
1068
1072
  util.MergeInterfaceParams<A, B>
1069
1073
  >;
1070
1074
 
@@ -1153,7 +1157,7 @@ export const ZodInterface: core.$constructor<ZodInterface> = /*@__PURE__*/ core.
1153
1157
  (inst, def) => {
1154
1158
  core.$ZodInterface.init(inst, def);
1155
1159
  ZodType.init(inst, def);
1156
- util.defineLazy(inst._zod, "shape", () => def.shape);
1160
+ // util.defineLazy(inst._zod, "shape", () => def.shape);
1157
1161
 
1158
1162
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
1159
1163
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
@@ -1270,12 +1274,7 @@ export interface ZodObject<
1270
1274
  /** @deprecated This is the default behavior. This method call is likely unnecessary. */
1271
1275
  strip(): ZodObject<Shape, {}>;
1272
1276
 
1273
- extend<U extends ZodObject>(
1274
- shape: U
1275
- ): ZodObject<
1276
- util.ExtendShape<Shape, U["_zod"]["shape"]>,
1277
- Extra // & B['_zod']["extra"]
1278
- >;
1277
+ extend<const U extends ZodObject>(schema: U): ZodObject<util.ExtendShape<Shape, U["_zod"]["def"]["shape"]>, Extra>;
1279
1278
  extend<U extends core.$ZodShape>(
1280
1279
  shape: U
1281
1280
  ): ZodObject<
@@ -1401,17 +1400,23 @@ export function looseObject<T extends core.$ZodShape>(
1401
1400
  export function extend<T extends ZodInterface, U extends ZodInterface>(
1402
1401
  a: T,
1403
1402
  b: U
1404
- ): ZodInterface<util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>, util.MergeInterfaceParams<T, U>>;
1403
+ ): ZodInterface<
1404
+ util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
1405
+ util.MergeInterfaceParams<T, U>
1406
+ >;
1405
1407
  export function extend<T extends ZodObject, U extends ZodObject>(
1406
1408
  a: T,
1407
1409
  b: U
1408
- ): ZodObject<util.ExtendObject<T["_zod"]["shape"], U["_zod"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
1410
+ ): ZodObject<
1411
+ util.ExtendObject<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
1412
+ U["_zod"]["extra"] & T["_zod"]["extra"]
1413
+ >;
1409
1414
  export function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
1410
1415
  schema: T,
1411
1416
  shape: U
1412
1417
  ): T extends ZodInterface<infer TShape, infer TParams>
1413
1418
  ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>>
1414
- : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
1419
+ : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
1415
1420
  export function extend(schema: ZodObjectLike, shape: core.$ZodShape): ZodObjectLike {
1416
1421
  if (shape instanceof core.$ZodType) return util.mergeObjectLike(schema, shape as any);
1417
1422
  if (schema instanceof ZodInterface) {
@@ -1427,51 +1432,57 @@ export function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
1427
1432
  ): T["_zod"]["def"]["type"] extends "interface"
1428
1433
  ? // T extends ZodInterface
1429
1434
  ZodInterface<
1430
- util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>,
1435
+ util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
1431
1436
  {
1432
1437
  extra: T["_zod"]["extra"] & U["_zod"]["extra"];
1433
- optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["shape"]> | U["_zod"]["optional"];
1434
- defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["shape"]> | U["_zod"]["defaulted"];
1438
+ optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
1439
+ defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
1435
1440
  }
1436
1441
  >
1437
- : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
1442
+ : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
1438
1443
  export function merge(a: ZodObjectLike, b: ZodObjectLike): ZodObjectLike {
1439
1444
  return util.mergeObjectLike(a, b);
1440
1445
  }
1441
1446
 
1442
1447
  // .pick
1443
- export function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(
1448
+ export function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(
1444
1449
  schema: T,
1445
1450
  mask: M
1446
1451
  ): T["_zod"]["def"]["type"] extends "interface"
1447
1452
  ? ZodInterface<
1448
- util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>,
1453
+ util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>,
1449
1454
  {
1450
1455
  optional: Extract<T["_zod"]["optional"], keyof M>;
1451
1456
  defaulted: Extract<T["_zod"]["defaulted"], keyof M>;
1452
1457
  extra: T["_zod"]["extra"];
1453
1458
  }
1454
1459
  >
1455
- : ZodObject<util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>, T["_zod"]["extra"]>;
1460
+ : ZodObject<
1461
+ util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>,
1462
+ T["_zod"]["extra"]
1463
+ >;
1456
1464
  export function pick(schema: ZodObjectLike, mask: object) {
1457
1465
  // const picked = util.pick(schema, mask);
1458
1466
  return util.pick(schema, mask);
1459
1467
  }
1460
1468
 
1461
1469
  // .omit
1462
- export function omit<T extends ZodObjectLike, const M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(
1470
+ export function omit<
1471
+ T extends ZodObjectLike,
1472
+ const M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>,
1473
+ >(
1463
1474
  schema: T,
1464
1475
  mask: M
1465
1476
  ): T["_zod"]["def"]["type"] extends "interface"
1466
1477
  ? ZodInterface<
1467
- util.Flatten<Omit<T["_zod"]["shape"], keyof M>>,
1478
+ util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>,
1468
1479
  {
1469
1480
  optional: Exclude<T["_zod"]["optional"], keyof M>;
1470
1481
  defaulted: Exclude<T["_zod"]["defaulted"], keyof M>;
1471
1482
  extra: T["_zod"]["extra"];
1472
1483
  }
1473
1484
  >
1474
- : ZodObject<util.Flatten<Omit<T["_zod"]["shape"], keyof M>>, T["_zod"]["extra"]>;
1485
+ : ZodObject<util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>, T["_zod"]["extra"]>;
1475
1486
 
1476
1487
  export function omit(schema: ZodObjectLike, mask: object) {
1477
1488
  return util.omit(schema, mask);
@@ -1483,29 +1494,29 @@ export function partial<T extends ZodObjectLike>(
1483
1494
  ? ZodInterface<
1484
1495
  // T['_zod']["shape"],
1485
1496
  {
1486
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
1497
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1487
1498
  },
1488
1499
  {
1489
- optional: string & keyof T["_zod"]["shape"];
1500
+ optional: string & keyof T["_zod"]["def"]["shape"];
1490
1501
  defaulted: never;
1491
1502
  extra: T["_zod"]["extra"];
1492
1503
  }
1493
1504
  >
1494
1505
  : ZodObject<
1495
1506
  {
1496
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
1507
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1497
1508
  },
1498
1509
  T["_zod"]["extra"]
1499
1510
  >;
1500
- export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(
1511
+ export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(
1501
1512
  schema: T,
1502
1513
  mask: M
1503
1514
  ): T["_zod"]["def"]["type"] extends "interface"
1504
1515
  ? ZodInterface<
1505
1516
  util.ExtendShape<
1506
- T["_zod"]["shape"],
1517
+ T["_zod"]["def"]["shape"],
1507
1518
  {
1508
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
1519
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1509
1520
  }
1510
1521
  >,
1511
1522
  {
@@ -1516,7 +1527,9 @@ export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mas
1516
1527
  >
1517
1528
  : ZodObject<
1518
1529
  {
1519
- [k in keyof T["_zod"]["shape"]]: k extends keyof M ? ZodOptional<T["_zod"]["shape"][k]> : T["_zod"]["shape"][k];
1530
+ [k in keyof T["_zod"]["def"]["shape"]]: k extends keyof M
1531
+ ? ZodOptional<T["_zod"]["def"]["shape"][k]>
1532
+ : T["_zod"]["def"]["shape"][k];
1520
1533
  },
1521
1534
  T["_zod"]["extra"]
1522
1535
  >;
@@ -1529,19 +1542,19 @@ export function partial(schema: ZodObjectLike, mask?: object): ZodObjectLike {
1529
1542
  export function required<T extends { _subtype: "object" } & ZodObject>(
1530
1543
  schema: T
1531
1544
  ): ZodObject<{
1532
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1545
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1533
1546
  }>;
1534
1547
  export function required<
1535
1548
  T extends { _subtype: "object" } & ZodObject,
1536
- M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>,
1549
+ M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>,
1537
1550
  >(
1538
1551
  schema: T,
1539
1552
  mask: M
1540
1553
  ): ZodObject<
1541
1554
  util.ExtendShape<
1542
- T["_zod"]["shape"],
1555
+ T["_zod"]["def"]["shape"],
1543
1556
  {
1544
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1557
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1545
1558
  }
1546
1559
  >
1547
1560
  >;
@@ -1549,7 +1562,7 @@ export function required<T extends { _subtype: "interface" } & ZodInterface>(
1549
1562
  schema: T
1550
1563
  ): ZodInterface<
1551
1564
  {
1552
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1565
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1553
1566
  },
1554
1567
  {
1555
1568
  optional: never;
@@ -1565,9 +1578,9 @@ export function required<
1565
1578
  mask: M
1566
1579
  ): ZodInterface<
1567
1580
  util.ExtendShape<
1568
- T["_zod"]["shape"],
1581
+ T["_zod"]["def"]["shape"],
1569
1582
  {
1570
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1583
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1571
1584
  }
1572
1585
  >,
1573
1586
  {
@@ -1845,8 +1858,11 @@ export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$construct
1845
1858
  };
1846
1859
  });
1847
1860
 
1848
- function _enum<const T extends string[]>(values: T, params?: core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>>;
1849
- function _enum<T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
1861
+ function _enum<const T extends readonly string[]>(
1862
+ values: T,
1863
+ params?: core.$ZodEnumParams
1864
+ ): ZodEnum<util.ToEnum<T[number]>>;
1865
+ function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
1850
1866
  function _enum(values: any, params?: core.$ZodEnumParams) {
1851
1867
  const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1852
1868