zod 4.0.0-beta.20250430T185432 → 4.0.0-beta.20250503T014749

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.
@@ -248,7 +248,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
248
248
  max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
249
249
  /** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
250
250
  int(params?: string | core.$ZodCheckNumberFormatParams): this;
251
- /** @deprecated This is now identical to `.int()` instead. Only numbers in the safe integer range are accepted. */
251
+ /** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
252
252
  safe(params?: string | core.$ZodCheckNumberFormatParams): this;
253
253
  positive(params?: string | core.$ZodCheckGreaterThanParams): this;
254
254
  nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
@@ -416,6 +416,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
416
416
  defaulted: Params["defaulted"];
417
417
  extra: Record<string, T["_zod"]["output"]>;
418
418
  }>;
419
+ /** Consider `z.strictObject({ ...A.shape })` instead. */
419
420
  strict(): ZodInterface<Shape, {
420
421
  optional: Params["optional"];
421
422
  defaulted: Params["defaulted"];
@@ -426,6 +427,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
426
427
  defaulted: Params["defaulted"];
427
428
  extra: Record<string, unknown>;
428
429
  }>;
430
+ /** Use `z.looseObject({ ...A.shape })` instead. */
429
431
  strip(): ZodInterface<Shape, {
430
432
  optional: Params["optional"];
431
433
  defaulted: Params["defaulted"];
@@ -459,17 +461,19 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
459
461
  _zod: core.$ZodObjectInternals<Shape, Extra>;
460
462
  shape: Shape;
461
463
  keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
464
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
462
465
  catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, Record<string, T["_zod"]["output"]>>;
463
466
  /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
464
467
  passthrough(): ZodObject<Shape, Record<string, unknown>>;
468
+ /** Consider `z.looseObject(A.shape)` instead */
465
469
  loose(): ZodObject<Shape, Record<string, unknown>>;
466
- /** The `z.strictObject()` API is preferred. */
470
+ /** Consider `z.strictObject(A.shape)` instead */
467
471
  strict(): ZodObject<Shape, {}>;
468
- /** @deprecated This is the default behavior. This method call is likely unnecessary. */
472
+ /** This is the default behavior. This method call is likely unnecessary. */
469
473
  strip(): ZodObject<Shape, {}>;
470
474
  extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
471
475
  extend<U extends core.$ZodShape>(shape: U): ZodObject<util.Extend<Shape, U>, Extra>;
472
- /** @deprecated Use `A.extend(B)` */
476
+ /** @deprecated Use `A.extend(B.shape)` */
473
477
  merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
474
478
  pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
475
479
  omit<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
@@ -248,7 +248,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
248
248
  max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
249
249
  /** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
250
250
  int(params?: string | core.$ZodCheckNumberFormatParams): this;
251
- /** @deprecated This is now identical to `.int()` instead. Only numbers in the safe integer range are accepted. */
251
+ /** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
252
252
  safe(params?: string | core.$ZodCheckNumberFormatParams): this;
253
253
  positive(params?: string | core.$ZodCheckGreaterThanParams): this;
254
254
  nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
@@ -416,6 +416,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
416
416
  defaulted: Params["defaulted"];
417
417
  extra: Record<string, T["_zod"]["output"]>;
418
418
  }>;
419
+ /** Consider `z.strictObject({ ...A.shape })` instead. */
419
420
  strict(): ZodInterface<Shape, {
420
421
  optional: Params["optional"];
421
422
  defaulted: Params["defaulted"];
@@ -426,6 +427,7 @@ export interface ZodInterface<out Shape extends core.$ZodLooseShape = core.$ZodL
426
427
  defaulted: Params["defaulted"];
427
428
  extra: Record<string, unknown>;
428
429
  }>;
430
+ /** Use `z.looseObject({ ...A.shape })` instead. */
429
431
  strip(): ZodInterface<Shape, {
430
432
  optional: Params["optional"];
431
433
  defaulted: Params["defaulted"];
@@ -459,17 +461,19 @@ export interface ZodObject<out Shape extends core.$ZodShape = core.$ZodShape, Ex
459
461
  _zod: core.$ZodObjectInternals<Shape, Extra>;
460
462
  shape: Shape;
461
463
  keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
464
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
462
465
  catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, Record<string, T["_zod"]["output"]>>;
463
466
  /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
464
467
  passthrough(): ZodObject<Shape, Record<string, unknown>>;
468
+ /** Consider `z.looseObject(A.shape)` instead */
465
469
  loose(): ZodObject<Shape, Record<string, unknown>>;
466
- /** The `z.strictObject()` API is preferred. */
470
+ /** Consider `z.strictObject(A.shape)` instead */
467
471
  strict(): ZodObject<Shape, {}>;
468
- /** @deprecated This is the default behavior. This method call is likely unnecessary. */
472
+ /** This is the default behavior. This method call is likely unnecessary. */
469
473
  strip(): ZodObject<Shape, {}>;
470
474
  extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
471
475
  extend<U extends core.$ZodShape>(shape: U): ZodObject<util.Extend<Shape, U>, Extra>;
472
- /** @deprecated Use `A.extend(B)` */
476
+ /** @deprecated Use `A.extend(B.shape)` */
473
477
  merge<U extends ZodObject<any, any>>(other: U): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;
474
478
  pick<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
475
479
  omit<M extends util.Exactly<util.Mask<string & keyof Shape>, M>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Extra>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.0.0-beta.20250430T185432",
3
+ "version": "4.0.0-beta.20250503T014749",
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.10.0"
73
+ "@zod/core": "0.10.1"
74
74
  },
75
75
  "scripts": {
76
76
  "clean": "rm -rf dist",
package/src/schemas.ts CHANGED
@@ -665,7 +665,7 @@ export interface _ZodNumber<Input = unknown> extends ZodType {
665
665
  max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
666
666
  /** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
667
667
  int(params?: string | core.$ZodCheckNumberFormatParams): this;
668
- /** @deprecated This is now identical to `.int()` instead. Only numbers in the safe integer range are accepted. */
668
+ /** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
669
669
  safe(params?: string | core.$ZodCheckNumberFormatParams): this;
670
670
  positive(params?: string | core.$ZodCheckGreaterThanParams): this;
671
671
  nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
@@ -1089,6 +1089,7 @@ export interface ZodInterface<
1089
1089
  extra: Record<string, T["_zod"]["output"]>;
1090
1090
  }
1091
1091
  >;
1092
+ /** Consider `z.strictObject({ ...A.shape })` instead. */
1092
1093
  strict(): ZodInterface<
1093
1094
  Shape,
1094
1095
  {
@@ -1097,6 +1098,7 @@ export interface ZodInterface<
1097
1098
  extra: {};
1098
1099
  }
1099
1100
  >;
1101
+
1100
1102
  loose(): ZodInterface<
1101
1103
  Shape,
1102
1104
  {
@@ -1105,6 +1107,8 @@ export interface ZodInterface<
1105
1107
  extra: Record<string, unknown>;
1106
1108
  }
1107
1109
  >;
1110
+
1111
+ /** Use `z.looseObject({ ...A.shape })` instead. */
1108
1112
  strip(): ZodInterface<
1109
1113
  Shape,
1110
1114
  {
@@ -1257,17 +1261,18 @@ export interface ZodObject<
1257
1261
  shape: Shape;
1258
1262
 
1259
1263
  keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
1264
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
1260
1265
  catchall<T extends core.$ZodType>(schema: T): ZodObject<Shape, Record<string, T["_zod"]["output"]>>;
1261
1266
 
1262
1267
  /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
1263
1268
  passthrough(): ZodObject<Shape, Record<string, unknown>>;
1264
-
1269
+ /** Consider `z.looseObject(A.shape)` instead */
1265
1270
  loose(): ZodObject<Shape, Record<string, unknown>>;
1266
1271
 
1267
- /** The `z.strictObject()` API is preferred. */
1272
+ /** Consider `z.strictObject(A.shape)` instead */
1268
1273
  strict(): ZodObject<Shape, {}>;
1269
1274
 
1270
- /** @deprecated This is the default behavior. This method call is likely unnecessary. */
1275
+ /** This is the default behavior. This method call is likely unnecessary. */
1271
1276
  strip(): ZodObject<Shape, {}>;
1272
1277
 
1273
1278
  extend<const U extends ZodObject>(schema: U): ZodObject<util.Extend<Shape, U["_zod"]["def"]["shape"]>, Extra>;
@@ -1279,7 +1284,7 @@ export interface ZodObject<
1279
1284
  >;
1280
1285
 
1281
1286
  // merge
1282
- /** @deprecated Use `A.extend(B)` */
1287
+ /** @deprecated Use `A.extend(B.shape)` */
1283
1288
  merge<U extends ZodObject<any, any>>(
1284
1289
  other: U
1285
1290
  ): ZodObject<util.Flatten<util.Extend<Shape, U["_zod"]["def"]["shape"]>>, Extra>;