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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/schemas.ts CHANGED
@@ -7,8 +7,6 @@ import * as parse from "./parse.js";
7
7
  export * as iso from "./iso.js";
8
8
  export * as coerce from "./coerce.js";
9
9
 
10
- type SomeType = core.$ZodType;
11
-
12
10
  ///////////////////////////////////////////
13
11
  ///////////////////////////////////////////
14
12
  //////////// ////////////
@@ -25,6 +23,10 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
25
23
  def: this["_zod"]["def"];
26
24
  /** @deprecated Use `.def` instead. */
27
25
  _def: this["_zod"]["def"];
26
+ /** @deprecated Use `z.output<typeof schema>` instead. */
27
+ _output: this["_zod"]["output"];
28
+ /** @deprecated Use `z.input<typeof schema>` instead. */
29
+ _input: this["_zod"]["input"];
28
30
  // base methods
29
31
  check(...checks: (core.CheckFn<this["_zod"]["output"]> | core.$ZodCheck<this["_zod"]["output"]>)[]): this;
30
32
  clone(def?: this["_zod"]["def"]): this;
@@ -70,7 +72,7 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
70
72
  default(def: () => util.NoUndefined<core.output<this>>, params?: core.$ZodDefaultParams): ZodDefault<this>;
71
73
  array(): ZodArray<this>;
72
74
  or<T extends core.$ZodType>(option: T): ZodUnion<[this, T]>;
73
- // and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
75
+ and<T extends core.$ZodType>(incoming: T): ZodIntersection<this, T>;
74
76
  transform<NewOut>(
75
77
  transform: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>
76
78
  ): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
@@ -135,7 +137,7 @@ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$construct
135
137
  inst.nonoptional = (params) => nonoptional(inst, params);
136
138
  inst.array = () => array(inst);
137
139
  inst.or = (arg) => union([inst, arg]);
138
- // inst.and = (arg) => intersection(inst, arg);
140
+ inst.and = (arg) => intersection(inst, arg);
139
141
  inst.transform = (tx) => pipe(inst, transform(tx as any)) as never;
140
142
  inst.default = (def, params) => _default(inst, def, params);
141
143
  // inst.coalesce = (def, params) => coalesce(inst, def, params);
@@ -979,7 +981,7 @@ export function date(params?: string | core.$ZodDateParams): ZodDate {
979
981
  }
980
982
 
981
983
  // ZodArray
982
- export interface ZodArray<T extends SomeType = SomeType> extends ZodType {
984
+ export interface ZodArray<T extends core.$ZodType = core.$ZodType> extends ZodType {
983
985
  _zod: core.$ZodArrayInternals<T>;
984
986
 
985
987
  element: T;
@@ -999,8 +1001,8 @@ export const ZodArray: core.$constructor<ZodArray> = /*@__PURE__*/ core.$constru
999
1001
  inst.length = (len, params) => inst.check(checks.length(len, params));
1000
1002
  });
1001
1003
 
1002
- export function array<T extends SomeType>(element: T, params?: core.$ZodArrayParams): ZodArray<T>;
1003
- export function array<T extends SomeType>(element: SomeType, params?: any): ZodArray<T> {
1004
+ export function array<T extends core.$ZodType>(element: T, params?: core.$ZodArrayParams): ZodArray<T>;
1005
+ export function array<T extends core.$ZodType>(element: core.$ZodType, params?: any): ZodArray<T> {
1004
1006
  return core._array(ZodArray, element, params) as any;
1005
1007
  }
1006
1008
 
@@ -1017,7 +1019,7 @@ export const ZodObjectLike: core.$constructor<ZodObjectLike> = /*@__PURE__*/ cor
1017
1019
  );
1018
1020
 
1019
1021
  // .keyof
1020
- export function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["shape"]>;
1022
+ export function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["def"]["shape"]>;
1021
1023
  export function keyof<T extends ZodInterface>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
1022
1024
  export function keyof(schema: ZodObjectLike) {
1023
1025
  const shape =
@@ -1031,12 +1033,12 @@ export function keyof(schema: ZodObjectLike) {
1031
1033
  // ZodInterface
1032
1034
  type ZodInterfacePartial<
1033
1035
  T extends ZodInterface,
1034
- Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"],
1036
+ Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"],
1035
1037
  > = ZodInterface<
1036
1038
  util.ExtendShape<
1037
- T["_zod"]["shape"],
1039
+ T["_zod"]["def"]["shape"],
1038
1040
  {
1039
- [k in Keys]: ZodOptional<T["_zod"]["shape"][k]>;
1041
+ [k in Keys]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1040
1042
  }
1041
1043
  >,
1042
1044
  {
@@ -1048,12 +1050,12 @@ type ZodInterfacePartial<
1048
1050
 
1049
1051
  type ZodInterfaceRequired<
1050
1052
  T extends ZodInterface,
1051
- Keys extends keyof T["_zod"]["shape"] = keyof T["_zod"]["shape"],
1053
+ Keys extends keyof T["_zod"]["def"]["shape"] = keyof T["_zod"]["def"]["shape"],
1052
1054
  > = ZodInterface<
1053
1055
  util.ExtendShape<
1054
- T["_zod"]["shape"],
1056
+ T["_zod"]["def"]["shape"],
1055
1057
  {
1056
- [k in Keys]: ZodNonOptional<T["_zod"]["shape"][k]>;
1058
+ [k in Keys]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1057
1059
  }
1058
1060
  >,
1059
1061
  {
@@ -1063,8 +1065,8 @@ type ZodInterfaceRequired<
1063
1065
  }
1064
1066
  >;
1065
1067
 
1066
- type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<
1067
- util.ExtendShape<A["_zod"]["shape"], B["_zod"]["shape"]>,
1068
+ export type MergeInterfaces<A extends ZodInterface, B extends ZodInterface> = ZodInterface<
1069
+ util.ExtendShape<A["_zod"]["def"]["shape"], B["_zod"]["def"]["shape"]>,
1068
1070
  util.MergeInterfaceParams<A, B>
1069
1071
  >;
1070
1072
 
@@ -1117,7 +1119,7 @@ export interface ZodInterface<
1117
1119
  shape: U
1118
1120
  ): MergeInterfaces<this, ZodInterface<U, util.InitInterfaceParams<U, {}>>>;
1119
1121
 
1120
- /** @deprecated Use `.extend()` */
1122
+ /** @deprecated Use `A.extend(B)` */
1121
1123
  merge<U extends ZodInterface>(incoming: U): MergeInterfaces<this, U>;
1122
1124
 
1123
1125
  pick<const M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(
@@ -1153,7 +1155,7 @@ export const ZodInterface: core.$constructor<ZodInterface> = /*@__PURE__*/ core.
1153
1155
  (inst, def) => {
1154
1156
  core.$ZodInterface.init(inst, def);
1155
1157
  ZodType.init(inst, def);
1156
- util.defineLazy(inst._zod, "shape", () => def.shape);
1158
+ // util.defineLazy(inst._zod, "shape", () => def.shape);
1157
1159
 
1158
1160
  inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
1159
1161
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
@@ -1270,12 +1272,7 @@ export interface ZodObject<
1270
1272
  /** @deprecated This is the default behavior. This method call is likely unnecessary. */
1271
1273
  strip(): ZodObject<Shape, {}>;
1272
1274
 
1273
- extend<U extends ZodObject>(
1274
- shape: U
1275
- ): ZodObject<
1276
- util.ExtendShape<Shape, U["_zod"]["shape"]>,
1277
- Extra // & B['_zod']["extra"]
1278
- >;
1275
+ extend<const U extends ZodObject>(schema: U): ZodObject<util.ExtendShape<Shape, U["_zod"]["def"]["shape"]>, Extra>;
1279
1276
  extend<U extends core.$ZodShape>(
1280
1277
  shape: U
1281
1278
  ): ZodObject<
@@ -1351,7 +1348,7 @@ export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$const
1351
1348
  inst.partial = (...args: any[]) => util.partialObjectLike(ZodOptional, inst, args[0] as object);
1352
1349
  inst.required = (...args: any[]) => util.requiredObjectLike(ZodNonOptional, inst, args[0] as object);
1353
1350
  });
1354
- export function object<T extends core.$ZodShape = Record<never, SomeType>>(
1351
+ export function object<T extends core.$ZodShape = Record<never, core.$ZodType>>(
1355
1352
  shape?: T,
1356
1353
  params?: core.$ZodObjectLikeParams
1357
1354
  ): ZodObject<T, {}> {
@@ -1401,17 +1398,23 @@ export function looseObject<T extends core.$ZodShape>(
1401
1398
  export function extend<T extends ZodInterface, U extends ZodInterface>(
1402
1399
  a: T,
1403
1400
  b: U
1404
- ): ZodInterface<util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>, util.MergeInterfaceParams<T, U>>;
1401
+ ): ZodInterface<
1402
+ util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
1403
+ util.MergeInterfaceParams<T, U>
1404
+ >;
1405
1405
  export function extend<T extends ZodObject, U extends ZodObject>(
1406
1406
  a: T,
1407
1407
  b: U
1408
- ): ZodObject<util.ExtendObject<T["_zod"]["shape"], U["_zod"]["shape"]>, U["_zod"]["extra"] & T["_zod"]["extra"]>;
1408
+ ): ZodObject<
1409
+ util.ExtendObject<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
1410
+ U["_zod"]["extra"] & T["_zod"]["extra"]
1411
+ >;
1409
1412
  export function extend<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
1410
1413
  schema: T,
1411
1414
  shape: U
1412
1415
  ): T extends ZodInterface<infer TShape, infer TParams>
1413
1416
  ? ZodInterface<util.ExtendInterfaceShape<TShape, U>, util.ExtendInterfaceParams<ZodInterface<TShape, TParams>, U>>
1414
- : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
1417
+ : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
1415
1418
  export function extend(schema: ZodObjectLike, shape: core.$ZodShape): ZodObjectLike {
1416
1419
  if (shape instanceof core.$ZodType) return util.mergeObjectLike(schema, shape as any);
1417
1420
  if (schema instanceof ZodInterface) {
@@ -1427,51 +1430,57 @@ export function merge<T extends ZodObjectLike, U extends core.$ZodLooseShape>(
1427
1430
  ): T["_zod"]["def"]["type"] extends "interface"
1428
1431
  ? // T extends ZodInterface
1429
1432
  ZodInterface<
1430
- util.ExtendShape<T["_zod"]["shape"], U["_zod"]["shape"]>,
1433
+ util.ExtendShape<T["_zod"]["def"]["shape"], U["_zod"]["def"]["shape"]>,
1431
1434
  {
1432
1435
  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"];
1436
+ optional: Exclude<T["_zod"]["optional"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["optional"];
1437
+ defaulted: Exclude<T["_zod"]["defaulted"], keyof U["_zod"]["def"]["shape"]> | U["_zod"]["defaulted"];
1435
1438
  }
1436
1439
  >
1437
- : ZodObject<util.ExtendObject<T["_zod"]["shape"], U>, T["_zod"]["extra"]>;
1440
+ : ZodObject<util.ExtendObject<T["_zod"]["def"]["shape"], U>, T["_zod"]["extra"]>;
1438
1441
  export function merge(a: ZodObjectLike, b: ZodObjectLike): ZodObjectLike {
1439
1442
  return util.mergeObjectLike(a, b);
1440
1443
  }
1441
1444
 
1442
1445
  // .pick
1443
- export function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(
1446
+ export function pick<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(
1444
1447
  schema: T,
1445
1448
  mask: M
1446
1449
  ): T["_zod"]["def"]["type"] extends "interface"
1447
1450
  ? ZodInterface<
1448
- util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>,
1451
+ util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>,
1449
1452
  {
1450
1453
  optional: Extract<T["_zod"]["optional"], keyof M>;
1451
1454
  defaulted: Extract<T["_zod"]["defaulted"], keyof M>;
1452
1455
  extra: T["_zod"]["extra"];
1453
1456
  }
1454
1457
  >
1455
- : ZodObject<util.Flatten<Pick<T["_zod"]["shape"], keyof T["_zod"]["shape"] & keyof M>>, T["_zod"]["extra"]>;
1458
+ : ZodObject<
1459
+ util.Flatten<Pick<T["_zod"]["def"]["shape"], keyof T["_zod"]["def"]["shape"] & keyof M>>,
1460
+ T["_zod"]["extra"]
1461
+ >;
1456
1462
  export function pick(schema: ZodObjectLike, mask: object) {
1457
1463
  // const picked = util.pick(schema, mask);
1458
1464
  return util.pick(schema, mask);
1459
1465
  }
1460
1466
 
1461
1467
  // .omit
1462
- export function omit<T extends ZodObjectLike, const M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(
1468
+ export function omit<
1469
+ T extends ZodObjectLike,
1470
+ const M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>,
1471
+ >(
1463
1472
  schema: T,
1464
1473
  mask: M
1465
1474
  ): T["_zod"]["def"]["type"] extends "interface"
1466
1475
  ? ZodInterface<
1467
- util.Flatten<Omit<T["_zod"]["shape"], keyof M>>,
1476
+ util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>,
1468
1477
  {
1469
1478
  optional: Exclude<T["_zod"]["optional"], keyof M>;
1470
1479
  defaulted: Exclude<T["_zod"]["defaulted"], keyof M>;
1471
1480
  extra: T["_zod"]["extra"];
1472
1481
  }
1473
1482
  >
1474
- : ZodObject<util.Flatten<Omit<T["_zod"]["shape"], keyof M>>, T["_zod"]["extra"]>;
1483
+ : ZodObject<util.Flatten<Omit<T["_zod"]["def"]["shape"], keyof M>>, T["_zod"]["extra"]>;
1475
1484
 
1476
1485
  export function omit(schema: ZodObjectLike, mask: object) {
1477
1486
  return util.omit(schema, mask);
@@ -1483,29 +1492,29 @@ export function partial<T extends ZodObjectLike>(
1483
1492
  ? ZodInterface<
1484
1493
  // T['_zod']["shape"],
1485
1494
  {
1486
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
1495
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1487
1496
  },
1488
1497
  {
1489
- optional: string & keyof T["_zod"]["shape"];
1498
+ optional: string & keyof T["_zod"]["def"]["shape"];
1490
1499
  defaulted: never;
1491
1500
  extra: T["_zod"]["extra"];
1492
1501
  }
1493
1502
  >
1494
1503
  : ZodObject<
1495
1504
  {
1496
- [k in keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
1505
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1497
1506
  },
1498
1507
  T["_zod"]["extra"]
1499
1508
  >;
1500
- export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>>(
1509
+ export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>>(
1501
1510
  schema: T,
1502
1511
  mask: M
1503
1512
  ): T["_zod"]["def"]["type"] extends "interface"
1504
1513
  ? ZodInterface<
1505
1514
  util.ExtendShape<
1506
- T["_zod"]["shape"],
1515
+ T["_zod"]["def"]["shape"],
1507
1516
  {
1508
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodOptional<T["_zod"]["shape"][k]>;
1517
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodOptional<T["_zod"]["def"]["shape"][k]>;
1509
1518
  }
1510
1519
  >,
1511
1520
  {
@@ -1516,7 +1525,9 @@ export function partial<T extends ZodObjectLike, M extends util.Exactly<util.Mas
1516
1525
  >
1517
1526
  : ZodObject<
1518
1527
  {
1519
- [k in keyof T["_zod"]["shape"]]: k extends keyof M ? ZodOptional<T["_zod"]["shape"][k]> : T["_zod"]["shape"][k];
1528
+ [k in keyof T["_zod"]["def"]["shape"]]: k extends keyof M
1529
+ ? ZodOptional<T["_zod"]["def"]["shape"][k]>
1530
+ : T["_zod"]["def"]["shape"][k];
1520
1531
  },
1521
1532
  T["_zod"]["extra"]
1522
1533
  >;
@@ -1529,19 +1540,19 @@ export function partial(schema: ZodObjectLike, mask?: object): ZodObjectLike {
1529
1540
  export function required<T extends { _subtype: "object" } & ZodObject>(
1530
1541
  schema: T
1531
1542
  ): ZodObject<{
1532
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1543
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1533
1544
  }>;
1534
1545
  export function required<
1535
1546
  T extends { _subtype: "object" } & ZodObject,
1536
- M extends util.Exactly<util.Mask<keyof T["_zod"]["shape"]>, M>,
1547
+ M extends util.Exactly<util.Mask<keyof T["_zod"]["def"]["shape"]>, M>,
1537
1548
  >(
1538
1549
  schema: T,
1539
1550
  mask: M
1540
1551
  ): ZodObject<
1541
1552
  util.ExtendShape<
1542
- T["_zod"]["shape"],
1553
+ T["_zod"]["def"]["shape"],
1543
1554
  {
1544
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1555
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1545
1556
  }
1546
1557
  >
1547
1558
  >;
@@ -1549,7 +1560,7 @@ export function required<T extends { _subtype: "interface" } & ZodInterface>(
1549
1560
  schema: T
1550
1561
  ): ZodInterface<
1551
1562
  {
1552
- [k in keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1563
+ [k in keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1553
1564
  },
1554
1565
  {
1555
1566
  optional: never;
@@ -1565,9 +1576,9 @@ export function required<
1565
1576
  mask: M
1566
1577
  ): ZodInterface<
1567
1578
  util.ExtendShape<
1568
- T["_zod"]["shape"],
1579
+ T["_zod"]["def"]["shape"],
1569
1580
  {
1570
- [k in keyof M & keyof T["_zod"]["shape"]]: ZodNonOptional<T["_zod"]["shape"][k]>;
1581
+ [k in keyof M & keyof T["_zod"]["def"]["shape"]]: ZodNonOptional<T["_zod"]["def"]["shape"][k]>;
1571
1582
  }
1572
1583
  >,
1573
1584
  {
@@ -1581,7 +1592,7 @@ export function required(schema: ZodObjectLike, mask?: object): ZodObjectLike {
1581
1592
  }
1582
1593
 
1583
1594
  // ZodUnion
1584
- export interface ZodUnion<T extends readonly SomeType[] = readonly SomeType[]> extends ZodType {
1595
+ export interface ZodUnion<T extends readonly core.$ZodType[] = readonly core.$ZodType[]> extends ZodType {
1585
1596
  _zod: core.$ZodUnionInternals<T>;
1586
1597
  options: T;
1587
1598
  }
@@ -1591,7 +1602,10 @@ export const ZodUnion: core.$constructor<ZodUnion> = /*@__PURE__*/ core.$constru
1591
1602
  inst.options = def.options;
1592
1603
  });
1593
1604
 
1594
- export function union<const T extends readonly SomeType[]>(options: T, params?: core.$ZodUnionParams): ZodUnion<T> {
1605
+ export function union<const T extends readonly core.$ZodType[]>(
1606
+ options: T,
1607
+ params?: core.$ZodUnionParams
1608
+ ): ZodUnion<T> {
1595
1609
  return new ZodUnion({
1596
1610
  type: "union",
1597
1611
  options,
@@ -1600,7 +1614,7 @@ export function union<const T extends readonly SomeType[]>(options: T, params?:
1600
1614
  }
1601
1615
 
1602
1616
  // ZodDiscriminatedUnion
1603
- export interface ZodDiscriminatedUnion<Options extends readonly SomeType[] = readonly SomeType[]>
1617
+ export interface ZodDiscriminatedUnion<Options extends readonly core.$ZodType[] = readonly core.$ZodType[]>
1604
1618
  extends ZodUnion<Options> {
1605
1619
  _zod: core.$ZodDiscriminatedUnionInternals<Options>;
1606
1620
  }
@@ -1640,7 +1654,8 @@ export function discriminatedUnion(...args: any[]): any {
1640
1654
  }
1641
1655
 
1642
1656
  // ZodIntersection
1643
- export interface ZodIntersection<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodType {
1657
+ export interface ZodIntersection<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType>
1658
+ extends ZodType {
1644
1659
  _zod: core.$ZodIntersectionInternals<A, B>;
1645
1660
  }
1646
1661
  export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/ core.$constructor(
@@ -1651,7 +1666,7 @@ export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/
1651
1666
  }
1652
1667
  );
1653
1668
 
1654
- export function intersection<T extends SomeType, U extends SomeType>(
1669
+ export function intersection<T extends core.$ZodType, U extends core.$ZodType>(
1655
1670
  left: T,
1656
1671
  right: U,
1657
1672
  params?: core.$ZodIntersectionParams
@@ -1665,8 +1680,10 @@ export function intersection<T extends SomeType, U extends SomeType>(
1665
1680
  }
1666
1681
 
1667
1682
  // ZodTuple
1668
- export interface ZodTuple<T extends util.TupleItems = util.TupleItems, Rest extends SomeType | null = SomeType | null>
1669
- extends ZodType {
1683
+ export interface ZodTuple<
1684
+ T extends util.TupleItems = util.TupleItems,
1685
+ Rest extends core.$ZodType | null = core.$ZodType | null,
1686
+ > extends ZodType {
1670
1687
  _zod: core.$ZodTupleInternals<T, Rest>;
1671
1688
  rest<Rest extends core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
1672
1689
  }
@@ -1680,19 +1697,19 @@ export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constru
1680
1697
  }) as any;
1681
1698
  });
1682
1699
 
1683
- export function tuple<T extends readonly [SomeType, ...SomeType[]]>(
1700
+ export function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]]>(
1684
1701
  items: T,
1685
1702
  params?: core.$ZodTupleParams
1686
1703
  ): ZodTuple<T, null>;
1687
- export function tuple<T extends readonly [SomeType, ...SomeType[]], Rest extends SomeType>(
1704
+ export function tuple<T extends readonly [core.$ZodType, ...core.$ZodType[]], Rest extends core.$ZodType>(
1688
1705
  items: T,
1689
1706
  rest: Rest,
1690
1707
  params?: core.$ZodTupleParams
1691
1708
  ): ZodTuple<T, Rest>;
1692
1709
  export function tuple(items: [], params?: core.$ZodTupleParams): ZodTuple<[], null>;
1693
1710
  export function tuple(
1694
- items: SomeType[],
1695
- _paramsOrRest?: core.$ZodTupleParams | SomeType,
1711
+ items: core.$ZodType[],
1712
+ _paramsOrRest?: core.$ZodTupleParams | core.$ZodType,
1696
1713
  _params?: core.$ZodTupleParams
1697
1714
  ) {
1698
1715
  const hasRest = _paramsOrRest instanceof core.$ZodType;
@@ -1707,8 +1724,10 @@ export function tuple(
1707
1724
  }
1708
1725
 
1709
1726
  // ZodRecord
1710
- export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends SomeType = SomeType>
1711
- extends ZodType {
1727
+ export interface ZodRecord<
1728
+ Key extends core.$ZodRecordKey = core.$ZodRecordKey,
1729
+ Value extends core.$ZodType = core.$ZodType,
1730
+ > extends ZodType {
1712
1731
  _zod: core.$ZodRecordInternals<Key, Value>;
1713
1732
  keyType: Key;
1714
1733
  valueType: Value;
@@ -1721,7 +1740,7 @@ export const ZodRecord: core.$constructor<ZodRecord> = /*@__PURE__*/ core.$const
1721
1740
  inst.valueType = def.valueType;
1722
1741
  });
1723
1742
 
1724
- export function record<Key extends core.$ZodRecordKey, Value extends SomeType>(
1743
+ export function record<Key extends core.$ZodRecordKey, Value extends core.$ZodType>(
1725
1744
  keyType: Key,
1726
1745
  valueType: Value,
1727
1746
  params?: core.$ZodRecordParams
@@ -1735,7 +1754,8 @@ export function record<Key extends core.$ZodRecordKey, Value extends SomeType>(
1735
1754
  }
1736
1755
 
1737
1756
  // ZodMap
1738
- export interface ZodMap<Key extends SomeType = SomeType, Value extends SomeType = SomeType> extends ZodType {
1757
+ export interface ZodMap<Key extends core.$ZodType = core.$ZodType, Value extends core.$ZodType = core.$ZodType>
1758
+ extends ZodType {
1739
1759
  _zod: core.$ZodMapInternals<Key, Value>;
1740
1760
 
1741
1761
  keyType: Key;
@@ -1748,7 +1768,7 @@ export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor
1748
1768
  inst.valueType = def.valueType;
1749
1769
  });
1750
1770
 
1751
- export function map<Key extends SomeType, Value extends SomeType>(
1771
+ export function map<Key extends core.$ZodType, Value extends core.$ZodType>(
1752
1772
  keyType: Key,
1753
1773
  valueType: Value,
1754
1774
  params?: core.$ZodMapParams
@@ -1762,7 +1782,7 @@ export function map<Key extends SomeType, Value extends SomeType>(
1762
1782
  }
1763
1783
 
1764
1784
  // ZodSet
1765
- export interface ZodSet<T extends SomeType = SomeType> extends ZodType {
1785
+ export interface ZodSet<T extends core.$ZodType = core.$ZodType> extends ZodType {
1766
1786
  _zod: core.$ZodSetInternals<T>;
1767
1787
  min(minSize: number, params?: core.$ZodCheckMinSizeParams): this;
1768
1788
  /** */
@@ -1780,7 +1800,7 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor
1780
1800
  inst.size = (...args) => inst.check(core._size(...args));
1781
1801
  });
1782
1802
 
1783
- export function set<Value extends SomeType>(valueType: Value, params?: core.$ZodSetParams): ZodSet<Value> {
1803
+ export function set<Value extends core.$ZodType>(valueType: Value, params?: core.$ZodSetParams): ZodSet<Value> {
1784
1804
  return new ZodSet({
1785
1805
  type: "set",
1786
1806
  valueType,
@@ -1845,8 +1865,11 @@ export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$construct
1845
1865
  };
1846
1866
  });
1847
1867
 
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>;
1868
+ function _enum<const T extends readonly string[]>(
1869
+ values: T,
1870
+ params?: core.$ZodEnumParams
1871
+ ): ZodEnum<util.ToEnum<T[number]>>;
1872
+ function _enum<const T extends util.EnumLike>(entries: T, params?: core.$ZodEnumParams): ZodEnum<T>;
1850
1873
  function _enum(values: any, params?: core.$ZodEnumParams) {
1851
1874
  const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1852
1875
 
@@ -1970,7 +1993,7 @@ export function transform<I = unknown, O = I>(
1970
1993
  }
1971
1994
 
1972
1995
  // ZodOptional
1973
- export interface ZodOptional<T extends SomeType = SomeType> extends ZodType {
1996
+ export interface ZodOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
1974
1997
  _zod: core.$ZodOptionalInternals<T>;
1975
1998
 
1976
1999
  unwrap(): T;
@@ -1985,7 +2008,7 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
1985
2008
  }
1986
2009
  );
1987
2010
 
1988
- export function optional<T extends SomeType>(innerType: T, params?: core.$ZodOptionalParams): ZodOptional<T> {
2011
+ export function optional<T extends core.$ZodType>(innerType: T, params?: core.$ZodOptionalParams): ZodOptional<T> {
1989
2012
  return new ZodOptional({
1990
2013
  type: "optional",
1991
2014
  innerType,
@@ -1994,7 +2017,7 @@ export function optional<T extends SomeType>(innerType: T, params?: core.$ZodOpt
1994
2017
  }
1995
2018
 
1996
2019
  // ZodNullable
1997
- export interface ZodNullable<T extends SomeType = SomeType> extends ZodType {
2020
+ export interface ZodNullable<T extends core.$ZodType = core.$ZodType> extends ZodType {
1998
2021
  _zod: core.$ZodNullableInternals<T>;
1999
2022
 
2000
2023
  unwrap(): T;
@@ -2009,7 +2032,7 @@ export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$c
2009
2032
  }
2010
2033
  );
2011
2034
 
2012
- export function nullable<T extends SomeType>(innerType: T, params?: core.$ZodNullableParams): ZodNullable<T> {
2035
+ export function nullable<T extends core.$ZodType>(innerType: T, params?: core.$ZodNullableParams): ZodNullable<T> {
2013
2036
  return new ZodNullable({
2014
2037
  type: "nullable",
2015
2038
  innerType,
@@ -2018,12 +2041,12 @@ export function nullable<T extends SomeType>(innerType: T, params?: core.$ZodNul
2018
2041
  }
2019
2042
 
2020
2043
  // nullish
2021
- export function nullish<T extends SomeType>(innerType: T): ZodOptional<ZodNullable<T>> {
2044
+ export function nullish<T extends core.$ZodType>(innerType: T): ZodOptional<ZodNullable<T>> {
2022
2045
  return optional(nullable(innerType));
2023
2046
  }
2024
2047
 
2025
2048
  // ZodDefault
2026
- export interface ZodDefault<T extends SomeType = SomeType> extends ZodType {
2049
+ export interface ZodDefault<T extends core.$ZodType = core.$ZodType> extends ZodType {
2027
2050
  _zod: core.$ZodDefaultInternals<T>;
2028
2051
 
2029
2052
  unwrap(): T;
@@ -2038,7 +2061,7 @@ export const ZodDefault: core.$constructor<ZodDefault> = /*@__PURE__*/ core.$con
2038
2061
  inst.removeDefault = inst.unwrap;
2039
2062
  });
2040
2063
 
2041
- export function _default<T extends SomeType>(
2064
+ export function _default<T extends core.$ZodType>(
2042
2065
  innerType: T,
2043
2066
  defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>),
2044
2067
  params?: core.$ZodDefaultParams
@@ -2052,7 +2075,7 @@ export function _default<T extends SomeType>(
2052
2075
  }
2053
2076
 
2054
2077
  // ZodNonOptional
2055
- export interface ZodNonOptional<T extends SomeType = SomeType> extends ZodType {
2078
+ export interface ZodNonOptional<T extends core.$ZodType = core.$ZodType> extends ZodType {
2056
2079
  _zod: core.$ZodNonOptionalInternals<T>;
2057
2080
 
2058
2081
  unwrap(): T;
@@ -2067,7 +2090,10 @@ export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ c
2067
2090
  }
2068
2091
  );
2069
2092
 
2070
- export function nonoptional<T extends SomeType>(innerType: T, params?: core.$ZodNonOptionalParams): ZodNonOptional<T> {
2093
+ export function nonoptional<T extends core.$ZodType>(
2094
+ innerType: T,
2095
+ params?: core.$ZodNonOptionalParams
2096
+ ): ZodNonOptional<T> {
2071
2097
  return new ZodNonOptional({
2072
2098
  type: "nonoptional",
2073
2099
  innerType,
@@ -2076,7 +2102,7 @@ export function nonoptional<T extends SomeType>(innerType: T, params?: core.$Zod
2076
2102
  }
2077
2103
 
2078
2104
  // ZodSuccess
2079
- export interface ZodSuccess<T extends SomeType = SomeType> extends ZodType {
2105
+ export interface ZodSuccess<T extends core.$ZodType = core.$ZodType> extends ZodType {
2080
2106
  _zod: core.$ZodSuccessInternals<T>;
2081
2107
 
2082
2108
  unwrap(): T;
@@ -2088,7 +2114,7 @@ export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$con
2088
2114
  inst.unwrap = () => inst._zod.def.innerType;
2089
2115
  });
2090
2116
 
2091
- export function success<T extends SomeType>(innerType: T, params?: core.$ZodSuccessParams): ZodSuccess<T> {
2117
+ export function success<T extends core.$ZodType>(innerType: T, params?: core.$ZodSuccessParams): ZodSuccess<T> {
2092
2118
  return new ZodSuccess({
2093
2119
  type: "success",
2094
2120
  innerType,
@@ -2097,7 +2123,7 @@ export function success<T extends SomeType>(innerType: T, params?: core.$ZodSucc
2097
2123
  }
2098
2124
 
2099
2125
  // ZodCatch
2100
- export interface ZodCatch<T extends SomeType = SomeType> extends ZodType {
2126
+ export interface ZodCatch<T extends core.$ZodType = core.$ZodType> extends ZodType {
2101
2127
  _zod: core.$ZodCatchInternals<T>;
2102
2128
 
2103
2129
  unwrap(): T;
@@ -2112,7 +2138,7 @@ export const ZodCatch: core.$constructor<ZodCatch> = /*@__PURE__*/ core.$constru
2112
2138
  inst.removeCatch = inst.unwrap;
2113
2139
  });
2114
2140
 
2115
- function _catch<T extends SomeType>(
2141
+ function _catch<T extends core.$ZodType>(
2116
2142
  innerType: T,
2117
2143
  catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>),
2118
2144
  params?: core.$ZodCatchParams
@@ -2142,7 +2168,8 @@ export function nan(params?: string | core.$ZodNaNParams): ZodNaN {
2142
2168
  }
2143
2169
 
2144
2170
  // ZodPipe
2145
- export interface ZodPipe<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodType {
2171
+ export interface ZodPipe<A extends core.$ZodType = core.$ZodType, B extends core.$ZodType = core.$ZodType>
2172
+ extends ZodType {
2146
2173
  _zod: core.$ZodPipeInternals<A, B>;
2147
2174
 
2148
2175
  in: A;
@@ -2170,7 +2197,7 @@ export function pipe(in_: core.$ZodType, out: core.$ZodType, params?: core.$ZodP
2170
2197
  }
2171
2198
 
2172
2199
  // ZodReadonly
2173
- export interface ZodReadonly<T extends SomeType = SomeType> extends ZodType {
2200
+ export interface ZodReadonly<T extends core.$ZodType = core.$ZodType> extends ZodType {
2174
2201
  _zod: core.$ZodReadonlyInternals<T>;
2175
2202
  }
2176
2203
  export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$constructor(
@@ -2181,7 +2208,7 @@ export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$c
2181
2208
  }
2182
2209
  );
2183
2210
 
2184
- export function readonly<T extends SomeType>(innerType: T, params?: core.$ZodReadonlyParams): ZodReadonly<T> {
2211
+ export function readonly<T extends core.$ZodType>(innerType: T, params?: core.$ZodReadonlyParams): ZodReadonly<T> {
2185
2212
  return new ZodReadonly({
2186
2213
  type: "readonly",
2187
2214
  innerType,
@@ -2213,7 +2240,7 @@ export function templateLiteral<const Parts extends core.$TemplateLiteralPart[]>
2213
2240
  }
2214
2241
 
2215
2242
  // ZodLazy
2216
- export interface ZodLazy<T extends SomeType = SomeType> extends ZodType {
2243
+ export interface ZodLazy<T extends core.$ZodType = core.$ZodType> extends ZodType {
2217
2244
  _zod: core.$ZodLazyInternals<T>;
2218
2245
 
2219
2246
  unwrap(): T;
@@ -2225,7 +2252,7 @@ export const ZodLazy: core.$constructor<ZodLazy> = /*@__PURE__*/ core.$construct
2225
2252
  inst.unwrap = () => inst._zod.def.getter();
2226
2253
  });
2227
2254
 
2228
- export function lazy<T extends SomeType>(getter: () => T): ZodLazy<T> {
2255
+ export function lazy<T extends core.$ZodType>(getter: () => T): ZodLazy<T> {
2229
2256
  return new ZodLazy({
2230
2257
  type: "lazy",
2231
2258
  getter,
@@ -2233,7 +2260,7 @@ export function lazy<T extends SomeType>(getter: () => T): ZodLazy<T> {
2233
2260
  }
2234
2261
 
2235
2262
  // ZodPromise
2236
- export interface ZodPromise<T extends SomeType = SomeType> extends ZodType {
2263
+ export interface ZodPromise<T extends core.$ZodType = core.$ZodType> extends ZodType {
2237
2264
  _zod: core.$ZodPromiseInternals<T>;
2238
2265
 
2239
2266
  unwrap(): T;
@@ -2245,7 +2272,7 @@ export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$con
2245
2272
  inst.unwrap = () => inst._zod.def.innerType;
2246
2273
  });
2247
2274
 
2248
- export function promise<T extends SomeType>(innerType: T, params?: core.$ZodPromiseParams): ZodPromise<T> {
2275
+ export function promise<T extends core.$ZodType>(innerType: T, params?: core.$ZodPromiseParams): ZodPromise<T> {
2249
2276
  return new ZodPromise({
2250
2277
  type: "promise",
2251
2278
  innerType,