zod 3.25.50-beta.0 → 3.25.50

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.
@@ -347,6 +347,7 @@ exports.$ZodCheckMaxLength = core.$constructor("$ZodCheckMaxLength", (inst, def)
347
347
  origin,
348
348
  code: "too_big",
349
349
  maximum: def.maximum,
350
+ inclusive: true,
350
351
  input,
351
352
  inst,
352
353
  continue: !def.abort,
@@ -374,6 +375,7 @@ exports.$ZodCheckMinLength = core.$constructor("$ZodCheckMinLength", (inst, def)
374
375
  origin,
375
376
  code: "too_small",
376
377
  minimum: def.minimum,
378
+ inclusive: true,
377
379
  input,
378
380
  inst,
379
381
  continue: !def.abort,
@@ -15,7 +15,8 @@ function $constructor(name, initializer, params) {
15
15
  initializer(inst, def);
16
16
  // support prototype modifications
17
17
  for (const k in _.prototype) {
18
- Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
18
+ if (!(k in inst))
19
+ Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
19
20
  }
20
21
  inst._zod.constr = _;
21
22
  inst._zod.def = def;
@@ -447,9 +447,6 @@ function strictObject(shape, params) {
447
447
  core_1.util.assignProp(this, "shape", { ...shape });
448
448
  return this.shape;
449
449
  },
450
- // get optional() {
451
- // return util.optionalKeys(shape);
452
- // },
453
450
  catchall: never(),
454
451
  ...core_1.util.normalizeParams(params),
455
452
  });
@@ -321,6 +321,7 @@ export const $ZodCheckMaxLength = /*@__PURE__*/ core.$constructor("$ZodCheckMaxL
321
321
  origin,
322
322
  code: "too_big",
323
323
  maximum: def.maximum,
324
+ inclusive: true,
324
325
  input,
325
326
  inst,
326
327
  continue: !def.abort,
@@ -348,6 +349,7 @@ export const $ZodCheckMinLength = /*@__PURE__*/ core.$constructor("$ZodCheckMinL
348
349
  origin,
349
350
  code: "too_small",
350
351
  minimum: def.minimum,
352
+ inclusive: true,
351
353
  input,
352
354
  inst,
353
355
  continue: !def.abort,
@@ -10,7 +10,8 @@ export /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, params)
10
10
  initializer(inst, def);
11
11
  // support prototype modifications
12
12
  for (const k in _.prototype) {
13
- Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
13
+ if (!(k in inst))
14
+ Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
14
15
  }
15
16
  inst._zod.constr = _;
16
17
  inst._zod.def = def;
@@ -339,9 +339,6 @@ export function strictObject(shape, params) {
339
339
  util.assignProp(this, "shape", { ...shape });
340
340
  return this.shape;
341
341
  },
342
- // get optional() {
343
- // return util.optionalKeys(shape);
344
- // },
345
342
  catchall: never(),
346
343
  ...util.normalizeParams(params),
347
344
  });
@@ -6,12 +6,12 @@ export declare function string<T = unknown>(params?: string | core.$ZodStringPar
6
6
  export interface ZodCoercedNumber<T = unknown> extends schemas._ZodNumber<core.$ZodNumberInternals<T>> {
7
7
  }
8
8
  export declare function number<T = unknown>(params?: string | core.$ZodNumberParams): ZodCoercedNumber<T>;
9
- export interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<T> {
9
+ export interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<core.$ZodBooleanInternals<T>> {
10
10
  }
11
11
  export declare function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): ZodCoercedBoolean<T>;
12
- export interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<T> {
12
+ export interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<core.$ZodBigIntInternals<T>> {
13
13
  }
14
14
  export declare function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): ZodCoercedBigInt<T>;
15
- export interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<T> {
15
+ export interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<core.$ZodDateInternals<T>> {
16
16
  }
17
17
  export declare function date<T = unknown>(params?: string | core.$ZodDateParams): ZodCoercedDate<T>;
@@ -4,10 +4,9 @@ import * as parse from "./parse.js";
4
4
  export interface RefinementCtx<T = unknown> extends core.ParsePayload<T> {
5
5
  addIssue(arg: string | core.$ZodRawIssue | Partial<core.$ZodIssueCustom>): void;
6
6
  }
7
- export interface __ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends core._$ZodType<Internals> {
7
+ export interface ZodType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
8
8
  def: Internals["def"];
9
9
  type: Internals["def"]["type"];
10
- "~standard": core.$ZodStandardSchema<this>;
11
10
  /** @deprecated Use `.def` instead. */
12
11
  _def: Internals["def"];
13
12
  /** @deprecated Use `z.output<typeof schema>` instead. */
@@ -70,13 +69,10 @@ export interface __ZodType<out Internals extends core.$ZodTypeInternals = core.$
70
69
  */
71
70
  isNullable(): boolean;
72
71
  }
73
- export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends __ZodType<Internals>, core.$ZodType<Internals["output"], Internals["input"]> {
74
- _zod: Internals;
75
- }
76
- export interface ZodType<out Output = unknown, out Input = unknown> extends _ZodType<core.$ZodTypeInternals<Output, Input>> {
72
+ export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends ZodType<any, any, Internals> {
77
73
  }
78
74
  export declare const ZodType: core.$constructor<ZodType>;
79
- export interface _ZodString<Internals extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>> extends _ZodType<Internals> {
75
+ export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>> extends _ZodType<T> {
80
76
  format: string | null;
81
77
  minLength: number | null;
82
78
  maxLength: number | null;
@@ -309,13 +305,13 @@ export declare function int32(params?: string | core.$ZodCheckNumberFormatParams
309
305
  export interface ZodUInt32 extends ZodNumberFormat {
310
306
  }
311
307
  export declare function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32;
312
- export interface _ZodBoolean<T = unknown> extends _ZodType<core.$ZodBooleanInternals<T>> {
308
+ export interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals> extends _ZodType<T> {
313
309
  }
314
- export interface ZodBoolean extends _ZodBoolean<boolean> {
310
+ export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolean>> {
315
311
  }
316
312
  export declare const ZodBoolean: core.$constructor<ZodBoolean>;
317
313
  export declare function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean;
318
- export interface _ZodBigInt<T = unknown> extends _ZodType<core.$ZodBigIntInternals<T>> {
314
+ export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals> extends _ZodType<T> {
319
315
  gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
320
316
  /** Alias of `.gte()` */
321
317
  min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
@@ -333,7 +329,7 @@ export interface _ZodBigInt<T = unknown> extends _ZodType<core.$ZodBigIntInterna
333
329
  maxValue: bigint | null;
334
330
  format: string | null;
335
331
  }
336
- export interface ZodBigInt extends _ZodBigInt<bigint> {
332
+ export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {
337
333
  }
338
334
  export declare const ZodBigInt: core.$constructor<ZodBigInt>;
339
335
  export declare function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt;
@@ -374,7 +370,7 @@ export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {
374
370
  export declare const ZodVoid: core.$constructor<ZodVoid>;
375
371
  declare function _void(params?: string | core.$ZodVoidParams): ZodVoid;
376
372
  export { _void as void };
377
- export interface _ZodDate<T = unknown> extends _ZodType<core.$ZodDateInternals<T>> {
373
+ export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals> extends _ZodType<T> {
378
374
  min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
379
375
  max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
380
376
  /** @deprecated Not recommended. */
@@ -382,11 +378,11 @@ export interface _ZodDate<T = unknown> extends _ZodType<core.$ZodDateInternals<T
382
378
  /** @deprecated Not recommended. */
383
379
  maxDate: Date | null;
384
380
  }
385
- export interface ZodDate extends _ZodDate<Date> {
381
+ export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {
386
382
  }
387
383
  export declare const ZodDate: core.$constructor<ZodDate>;
388
384
  export declare function date(params?: string | core.$ZodDateParams): ZodDate;
389
- export interface ZodArray<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodArrayInternals<T>> {
385
+ export interface ZodArray<T extends core.SomeType = core.$ZodType> extends ZodType<any, any, core.$ZodArrayInternals<T>>, core.$ZodArray<T> {
390
386
  element: T;
391
387
  min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
392
388
  nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
@@ -395,12 +391,11 @@ export interface ZodArray<T extends core.SomeType = core.$ZodType> extends _ZodT
395
391
  unwrap(): T;
396
392
  }
397
393
  export declare const ZodArray: core.$constructor<ZodArray>;
398
- export declare function array<T extends core._$ZodType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
394
+ export declare function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
399
395
  export declare function keyof<T extends ZodObject>(schema: T): ZodLiteral<keyof T["_zod"]["output"]>;
400
396
  export interface ZodObject<
401
397
  /** @ts-ignore Cast variance */
402
- out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends __ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
403
- _zod: core.$ZodObjectInternals<Shape, Config>;
398
+ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
404
399
  shape: Shape;
405
400
  keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
406
401
  /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
@@ -444,7 +439,7 @@ out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.
444
439
  }, Config>;
445
440
  }
446
441
  export declare const ZodObject: core.$constructor<ZodObject>;
447
- export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T> & {}, core.$strip>;
442
+ export declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T>, core.$strip>;
448
443
  export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict>;
449
444
  export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose>;
450
445
  export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]> extends _ZodType<core.$ZodUnionInternals<T>>, core.$ZodUnion<T> {
@@ -452,7 +447,7 @@ export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$Zo
452
447
  }
453
448
  export declare const ZodUnion: core.$constructor<ZodUnion>;
454
449
  export declare function union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
455
- export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[]> extends ZodUnion<Options> {
450
+ export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[]> extends ZodUnion<Options>, core.$ZodDiscriminatedUnion<Options> {
456
451
  _zod: core.$ZodDiscriminatedUnionInternals<Options>;
457
452
  }
458
453
  export declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
@@ -481,7 +476,7 @@ export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends
481
476
  }
482
477
  export declare const ZodMap: core.$constructor<ZodMap>;
483
478
  export declare function map<Key extends core.SomeType, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
484
- export interface ZodSet<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSetInternals<T>>, core.$ZodSet<T> {
479
+ export interface ZodSet<T extends core.SomeType = core.$ZodType> extends ZodType<any, any, core.$ZodSetInternals<T>>, core.$ZodSet<T> {
485
480
  min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
486
481
  /** */
487
482
  nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
@@ -490,7 +485,7 @@ export interface ZodSet<T extends core.SomeType = core.$ZodType> extends _ZodTyp
490
485
  }
491
486
  export declare const ZodSet: core.$constructor<ZodSet>;
492
487
  export declare function set<Value extends core.SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value>;
493
- export interface ZodEnum<T extends util.EnumLike = util.EnumLike> extends _ZodType<core.$ZodEnumInternals<T>>, core.$ZodEnum<T> {
488
+ export interface ZodEnum<out T extends util.EnumLike = util.EnumLike> extends _ZodType<core.$ZodEnumInternals<T>>, core.$ZodEnum<T> {
494
489
  enum: T;
495
490
  options: Array<T[keyof T]>;
496
491
  extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
@@ -82,8 +82,7 @@ export interface _$ZodType<T extends _$ZodTypeInternals = _$ZodTypeInternals> {
82
82
  _zod: T;
83
83
  }
84
84
  export type SomeType = _$ZodType;
85
- export interface $ZodType<O = unknown, I = unknown> extends _$ZodType {
86
- _zod: $ZodTypeInternals<O, I>;
85
+ export interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> extends _$ZodType<Internals> {
87
86
  "~standard": $ZodStandardSchema<this>;
88
87
  }
89
88
  export declare const $ZodType: core.$constructor<$ZodType>;
@@ -585,8 +584,7 @@ export type $catchall<T extends _$ZodType> = {
585
584
  };
586
585
  export interface $ZodObject<
587
586
  /** @ts-ignore Cast variance */
588
- out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodType {
589
- _zod: $ZodObjectInternals<Shape, Params>;
587
+ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
590
588
  "~standard": $ZodStandardSchema<this>;
591
589
  }
592
590
  export declare const $ZodObject: core.$constructor<$ZodObject>;
@@ -1,22 +1,23 @@
1
1
  import * as core from "zod/v4/core";
2
2
  import { util } from "zod/v4/core";
3
3
  type SomeType = core.SomeType;
4
- export interface ZodMiniType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
4
+ export interface ZodMiniType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
5
5
  check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
6
- clone(def?: this["_zod"]["def"], params?: {
6
+ clone(def?: Internals["def"], params?: {
7
7
  parent: boolean;
8
8
  }): this;
9
9
  register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
10
10
  brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : this & Record<"_zod", Record<"output", core.output<this> & core.$brand<T>>>;
11
- def: this["_zod"]["def"];
11
+ def: Internals["def"];
12
12
  parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
13
13
  safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): util.SafeParseResult<core.output<this>>;
14
14
  parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
15
15
  safeParseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<util.SafeParseResult<core.output<this>>>;
16
16
  }
17
+ interface _ZodMiniType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals> extends ZodMiniType<Internals["output"], Internals["input"], Internals> {
18
+ }
17
19
  export declare const ZodMiniType: core.$constructor<ZodMiniType>;
18
- export interface ZodMiniString<Input = unknown> extends ZodMiniType {
19
- _zod: core.$ZodStringInternals<Input>;
20
+ export interface ZodMiniString<Input = unknown> extends _ZodMiniType<core.$ZodStringInternals<Input>>, core.$ZodString<Input> {
20
21
  }
21
22
  export declare const ZodMiniString: core.$constructor<ZodMiniString>;
22
23
  export declare function string(params?: string | core.$ZodStringParams): ZodMiniString<string>;
@@ -195,16 +196,14 @@ export interface ZodMiniDate<T = unknown> extends ZodMiniType {
195
196
  }
196
197
  export declare const ZodMiniDate: core.$constructor<ZodMiniDate>;
197
198
  export declare function date(params?: string | core.$ZodDateParams): ZodMiniDate<Date>;
198
- export interface ZodMiniArray<T extends SomeType = core.$ZodType> extends ZodMiniType {
199
- _zod: core.$ZodArrayInternals<T>;
199
+ export interface ZodMiniArray<T extends SomeType = core.$ZodType> extends _ZodMiniType<core.$ZodArrayInternals<T>>, core.$ZodArray<T> {
200
200
  }
201
201
  export declare const ZodMiniArray: core.$constructor<ZodMiniArray>;
202
202
  export declare function array<T extends SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodMiniArray<T>;
203
203
  export declare function keyof<T extends ZodMiniObject>(schema: T): ZodMiniLiteral<keyof T["shape"]>;
204
204
  export interface ZodMiniObject<
205
205
  /** @ts-ignore Cast variance */
206
- out Shape extends core.$ZodShape = core.$ZodShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends ZodMiniType {
207
- _zod: core.$ZodObjectInternals<Shape, Config>;
206
+ out Shape extends core.$ZodShape = core.$ZodShape, out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig> extends ZodMiniType<any, any, core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
208
207
  shape: Shape;
209
208
  }
210
209
  export declare const ZodMiniObject: core.$constructor<ZodMiniObject>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.25.50-beta.0",
3
+ "version": "3.25.50",
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",