zod 3.26.0-canary.20250702T074442 → 3.26.0-canary.20250702T200737

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": "3.26.0-canary.20250702T074442",
3
+ "version": "3.26.0-canary.20250702T200737",
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",
@@ -1447,6 +1447,9 @@ exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
1447
1447
  return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1448
1448
  });
1449
1449
  inst._zod.parse = (payload, ctx) => {
1450
+ if (def.innerType._zod.optin === "optional") {
1451
+ return def.innerType._zod.run(payload, ctx);
1452
+ }
1450
1453
  if (payload.value === undefined) {
1451
1454
  return payload;
1452
1455
  }
@@ -1416,6 +1416,9 @@ export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (ins
1416
1416
  return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1417
1417
  });
1418
1418
  inst._zod.parse = (payload, ctx) => {
1419
+ if (def.innerType._zod.optin === "optional") {
1420
+ return def.innerType._zod.run(payload, ctx);
1421
+ }
1419
1422
  if (payload.value === undefined) {
1420
1423
  return payload;
1421
1424
  }
package/v4/core/util.cjs CHANGED
@@ -397,6 +397,7 @@ function partial(Class, schema, mask) {
397
397
  }
398
398
  if (!mask[key])
399
399
  continue;
400
+ // if (oldShape[key]!._zod.optin === "optional") continue;
400
401
  shape[key] = Class
401
402
  ? new Class({
402
403
  type: "optional",
@@ -407,6 +408,7 @@ function partial(Class, schema, mask) {
407
408
  }
408
409
  else {
409
410
  for (const key in oldShape) {
411
+ // if (oldShape[key]!._zod.optin === "optional") continue;
410
412
  shape[key] = Class
411
413
  ? new Class({
412
414
  type: "optional",
package/v4/core/util.js CHANGED
@@ -352,6 +352,7 @@ export function partial(Class, schema, mask) {
352
352
  }
353
353
  if (!mask[key])
354
354
  continue;
355
+ // if (oldShape[key]!._zod.optin === "optional") continue;
355
356
  shape[key] = Class
356
357
  ? new Class({
357
358
  type: "optional",
@@ -362,6 +363,7 @@ export function partial(Class, schema, mask) {
362
363
  }
363
364
  else {
364
365
  for (const key in oldShape) {
366
+ // if (oldShape[key]!._zod.optin === "optional") continue;
365
367
  shape[key] = Class
366
368
  ? new Class({
367
369
  type: "optional",