zod 4.0.16 → 4.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.0.16",
3
+ "version": "4.0.17",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -1721,7 +1721,7 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1721
1721
  const _normalized = util.cached(() => {
1722
1722
  const keys = Object.keys(def.shape);
1723
1723
  for (const k of keys) {
1724
- if (!(def.shape[k] instanceof $ZodType)) {
1724
+ if (!def.shape[k]._zod.traits.has("$ZodType")) {
1725
1725
  throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1726
1726
  }
1727
1727
  }
@@ -3642,7 +3642,8 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
3642
3642
  $ZodType.init(inst, def);
3643
3643
  const regexParts: string[] = [];
3644
3644
  for (const part of def.parts) {
3645
- if (part instanceof $ZodType) {
3645
+ if (typeof part === "object" && part !== null) {
3646
+ // is Zod schema
3646
3647
  if (!part._zod.pattern) {
3647
3648
  // if (!source)
3648
3649
  throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 0,
4
- patch: 16 as number,
4
+ patch: 17 as number,
5
5
  } as const;
@@ -710,7 +710,7 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
710
710
  const _normalized = util.cached(() => {
711
711
  const keys = Object.keys(def.shape);
712
712
  for (const k of keys) {
713
- if (!(def.shape[k] instanceof exports.$ZodType)) {
713
+ if (!def.shape[k]._zod.traits.has("$ZodType")) {
714
714
  throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
715
715
  }
716
716
  }
@@ -1632,7 +1632,8 @@ exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, de
1632
1632
  exports.$ZodType.init(inst, def);
1633
1633
  const regexParts = [];
1634
1634
  for (const part of def.parts) {
1635
- if (part instanceof exports.$ZodType) {
1635
+ if (typeof part === "object" && part !== null) {
1636
+ // is Zod schema
1636
1637
  if (!part._zod.pattern) {
1637
1638
  // if (!source)
1638
1639
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
@@ -679,7 +679,7 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
679
679
  const _normalized = util.cached(() => {
680
680
  const keys = Object.keys(def.shape);
681
681
  for (const k of keys) {
682
- if (!(def.shape[k] instanceof $ZodType)) {
682
+ if (!def.shape[k]._zod.traits.has("$ZodType")) {
683
683
  throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
684
684
  }
685
685
  }
@@ -1601,7 +1601,8 @@ export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplate
1601
1601
  $ZodType.init(inst, def);
1602
1602
  const regexParts = [];
1603
1603
  for (const part of def.parts) {
1604
- if (part instanceof $ZodType) {
1604
+ if (typeof part === "object" && part !== null) {
1605
+ // is Zod schema
1605
1606
  if (!part._zod.pattern) {
1606
1607
  // if (!source)
1607
1608
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
@@ -4,5 +4,5 @@ exports.version = void 0;
4
4
  exports.version = {
5
5
  major: 4,
6
6
  minor: 0,
7
- patch: 16,
7
+ patch: 17,
8
8
  };
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 0,
4
- patch: 16,
4
+ patch: 17,
5
5
  };