zod 4.0.4 → 4.1.0-canary.20250709T185023

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/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  <br/>
11
11
 
12
12
  <p align="center">
13
- <a href="https://github.com/colinhacks/zod/actions?query=branch%3Amain"><img src="https://github.com/colinhacks/zod/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Zod CI status" /></a>
13
+ <a href="https://github.com/colinhacks/zod/actions?query=branch%3Amaster"><img src="https://github.com/colinhacks/zod/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Zod CI status" /></a>
14
14
  <a href="https://opensource.org/licenses/MIT" rel="nofollow"><img src="https://img.shields.io/github/license/colinhacks/zod" alt="License"></a>
15
15
  <a href="https://www.npmjs.com/package/zod" rel="nofollow"><img src="https://img.shields.io/npm/dw/zod.svg" alt="npm"></a>
16
16
  <a href="https://discord.gg/KaSRdyX2vc" rel="nofollow"><img src="https://img.shields.io/discord/893487829802418277?label=Discord&logo=discord&logoColor=white" alt="discord server"></a>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.0.4",
3
+ "version": "4.1.0-canary.20250709T185023",
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",
@@ -63,45 +63,4 @@ export type {
63
63
  ZodType as Schema,
64
64
  };
65
65
 
66
- /** Included for Zod 3 compatibility */
67
66
  export type ZodRawShape = core.$ZodShape;
68
-
69
- /** @deprecated Do not use. Only included for zod-to-json-schema compatibility. */
70
- export enum ZodFirstPartyTypeKind {
71
- ZodString = "ZodString",
72
- ZodNumber = "ZodNumber",
73
- ZodNaN = "ZodNaN",
74
- ZodBigInt = "ZodBigInt",
75
- ZodBoolean = "ZodBoolean",
76
- ZodDate = "ZodDate",
77
- ZodSymbol = "ZodSymbol",
78
- ZodUndefined = "ZodUndefined",
79
- ZodNull = "ZodNull",
80
- ZodAny = "ZodAny",
81
- ZodUnknown = "ZodUnknown",
82
- ZodNever = "ZodNever",
83
- ZodVoid = "ZodVoid",
84
- ZodArray = "ZodArray",
85
- ZodObject = "ZodObject",
86
- ZodUnion = "ZodUnion",
87
- ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
88
- ZodIntersection = "ZodIntersection",
89
- ZodTuple = "ZodTuple",
90
- ZodRecord = "ZodRecord",
91
- ZodMap = "ZodMap",
92
- ZodSet = "ZodSet",
93
- ZodFunction = "ZodFunction",
94
- ZodLazy = "ZodLazy",
95
- ZodLiteral = "ZodLiteral",
96
- ZodEnum = "ZodEnum",
97
- ZodEffects = "ZodEffects",
98
- ZodNativeEnum = "ZodNativeEnum",
99
- ZodOptional = "ZodOptional",
100
- ZodNullable = "ZodNullable",
101
- ZodDefault = "ZodDefault",
102
- ZodCatch = "ZodCatch",
103
- ZodPromise = "ZodPromise",
104
- ZodBranded = "ZodBranded",
105
- ZodPipeline = "ZodPipeline",
106
- ZodReadonly = "ZodReadonly",
107
- }
@@ -61,8 +61,7 @@ export interface ZodType<
61
61
 
62
62
  // refinements
63
63
  refine(check: (arg: core.output<this>) => unknown | Promise<unknown>, params?: string | core.$ZodCustomParams): this;
64
- /** @deprecated Use [`.check()`](https://zod.dev/api?id=check) instead.
65
- */
64
+ /** @deprecated Use `.check()` instead. */
66
65
  superRefine(
67
66
  refinement: (arg: core.output<this>, ctx: RefinementCtx<core.output<this>>) => void | Promise<void>
68
67
  ): this;
@@ -1075,7 +1074,17 @@ export interface ZodObject<
1075
1074
  ): ZodObject<util.Extend<Shape, U>, Config>;
1076
1075
 
1077
1076
  /**
1078
- * @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
1077
+ * @deprecated Use spread syntax and the `.shape` property to combine two object schemas:
1078
+ *
1079
+ * ```ts
1080
+ * const A = z.object({ a: z.string() });
1081
+ * const B = z.object({ b: z.number() });
1082
+ *
1083
+ * const C = z.object({
1084
+ * ...A.shape,
1085
+ * ...B.shape
1086
+ * });
1087
+ * ```
1079
1088
  */
1080
1089
  merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
1081
1090
 
@@ -79,16 +79,13 @@ export function _coercedString<T extends schemas.$ZodString>(
79
79
  });
80
80
  }
81
81
 
82
- export type $ZodStringFormatParams = CheckTypeParams<
83
- schemas.$ZodStringFormat,
84
- "format" | "coerce" | "when" | "pattern"
85
- >;
82
+ export type $ZodStringFormatParams = CheckTypeParams<schemas.$ZodStringFormat, "format" | "coerce">;
86
83
  export type $ZodCheckStringFormatParams = CheckParams<checks.$ZodCheckStringFormat, "format">;
87
84
  // custom format
88
85
 
89
86
  // Email
90
- export type $ZodEmailParams = StringFormatParams<schemas.$ZodEmail, "when">;
91
- export type $ZodCheckEmailParams = CheckStringFormatParams<schemas.$ZodEmail, "when">;
87
+ export type $ZodEmailParams = StringFormatParams<schemas.$ZodEmail>;
88
+ export type $ZodCheckEmailParams = CheckStringFormatParams<schemas.$ZodEmail>;
92
89
  export function _email<T extends schemas.$ZodEmail>(
93
90
  Class: util.SchemaClass<T>,
94
91
  params?: string | $ZodEmailParams | $ZodCheckEmailParams
@@ -103,8 +100,8 @@ export function _email<T extends schemas.$ZodEmail>(
103
100
  }
104
101
 
105
102
  // GUID
106
- export type $ZodGUIDParams = StringFormatParams<schemas.$ZodGUID, "pattern" | "when">;
107
- export type $ZodCheckGUIDParams = CheckStringFormatParams<schemas.$ZodGUID, "pattern" | "when">;
103
+ export type $ZodGUIDParams = StringFormatParams<schemas.$ZodGUID, "pattern">;
104
+ export type $ZodCheckGUIDParams = CheckStringFormatParams<schemas.$ZodGUID, "pattern">;
108
105
  export function _guid<T extends schemas.$ZodGUID>(
109
106
  Class: util.SchemaClass<T>,
110
107
  params?: string | $ZodGUIDParams | $ZodCheckGUIDParams
@@ -119,8 +116,8 @@ export function _guid<T extends schemas.$ZodGUID>(
119
116
  }
120
117
 
121
118
  // UUID
122
- export type $ZodUUIDParams = StringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
123
- export type $ZodCheckUUIDParams = CheckStringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
119
+ export type $ZodUUIDParams = StringFormatParams<schemas.$ZodUUID, "pattern">;
120
+ export type $ZodCheckUUIDParams = CheckStringFormatParams<schemas.$ZodUUID, "pattern">;
124
121
  export function _uuid<T extends schemas.$ZodUUID>(
125
122
  Class: util.SchemaClass<T>,
126
123
  params?: string | $ZodUUIDParams | $ZodCheckUUIDParams
@@ -135,8 +132,8 @@ export function _uuid<T extends schemas.$ZodUUID>(
135
132
  }
136
133
 
137
134
  // UUIDv4
138
- export type $ZodUUIDv4Params = StringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
139
- export type $ZodCheckUUIDv4Params = CheckStringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
135
+ export type $ZodUUIDv4Params = StringFormatParams<schemas.$ZodUUID, "pattern">;
136
+ export type $ZodCheckUUIDv4Params = CheckStringFormatParams<schemas.$ZodUUID, "pattern">;
140
137
  export function _uuidv4<T extends schemas.$ZodUUID>(
141
138
  Class: util.SchemaClass<T>,
142
139
  params?: string | $ZodUUIDv4Params | $ZodCheckUUIDv4Params
@@ -152,8 +149,8 @@ export function _uuidv4<T extends schemas.$ZodUUID>(
152
149
  }
153
150
 
154
151
  // UUIDv6
155
- export type $ZodUUIDv6Params = StringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
156
- export type $ZodCheckUUIDv6Params = CheckStringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
152
+ export type $ZodUUIDv6Params = StringFormatParams<schemas.$ZodUUID, "pattern">;
153
+ export type $ZodCheckUUIDv6Params = CheckStringFormatParams<schemas.$ZodUUID, "pattern">;
157
154
  export function _uuidv6<T extends schemas.$ZodUUID>(
158
155
  Class: util.SchemaClass<T>,
159
156
  params?: string | $ZodUUIDv6Params | $ZodCheckUUIDv6Params
@@ -169,8 +166,8 @@ export function _uuidv6<T extends schemas.$ZodUUID>(
169
166
  }
170
167
 
171
168
  // UUIDv7
172
- export type $ZodUUIDv7Params = StringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
173
- export type $ZodCheckUUIDv7Params = CheckStringFormatParams<schemas.$ZodUUID, "pattern" | "when">;
169
+ export type $ZodUUIDv7Params = StringFormatParams<schemas.$ZodUUID, "pattern">;
170
+ export type $ZodCheckUUIDv7Params = CheckStringFormatParams<schemas.$ZodUUID, "pattern">;
174
171
  export function _uuidv7<T extends schemas.$ZodUUID>(
175
172
  Class: util.SchemaClass<T>,
176
173
  params?: string | $ZodUUIDv7Params | $ZodCheckUUIDv7Params
@@ -186,8 +183,8 @@ export function _uuidv7<T extends schemas.$ZodUUID>(
186
183
  }
187
184
 
188
185
  // URL
189
- export type $ZodURLParams = StringFormatParams<schemas.$ZodURL, "when">;
190
- export type $ZodCheckURLParams = CheckStringFormatParams<schemas.$ZodURL, "when">;
186
+ export type $ZodURLParams = StringFormatParams<schemas.$ZodURL>;
187
+ export type $ZodCheckURLParams = CheckStringFormatParams<schemas.$ZodURL>;
191
188
  export function _url<T extends schemas.$ZodURL>(
192
189
  Class: util.SchemaClass<T>,
193
190
  params?: string | $ZodURLParams | $ZodCheckURLParams
@@ -202,8 +199,8 @@ export function _url<T extends schemas.$ZodURL>(
202
199
  }
203
200
 
204
201
  // Emoji
205
- export type $ZodEmojiParams = StringFormatParams<schemas.$ZodEmoji, "when">;
206
- export type $ZodCheckEmojiParams = CheckStringFormatParams<schemas.$ZodEmoji, "when">;
202
+ export type $ZodEmojiParams = StringFormatParams<schemas.$ZodEmoji>;
203
+ export type $ZodCheckEmojiParams = CheckStringFormatParams<schemas.$ZodEmoji>;
207
204
  export function _emoji<T extends schemas.$ZodEmoji>(
208
205
  Class: util.SchemaClass<T>,
209
206
  params?: string | $ZodEmojiParams | $ZodCheckEmojiParams
@@ -218,8 +215,8 @@ export function _emoji<T extends schemas.$ZodEmoji>(
218
215
  }
219
216
 
220
217
  // NanoID
221
- export type $ZodNanoIDParams = StringFormatParams<schemas.$ZodNanoID, "when">;
222
- export type $ZodCheckNanoIDParams = CheckStringFormatParams<schemas.$ZodNanoID, "when">;
218
+ export type $ZodNanoIDParams = StringFormatParams<schemas.$ZodNanoID>;
219
+ export type $ZodCheckNanoIDParams = CheckStringFormatParams<schemas.$ZodNanoID>;
223
220
  export function _nanoid<T extends schemas.$ZodNanoID>(
224
221
  Class: util.SchemaClass<T>,
225
222
  params?: string | $ZodNanoIDParams | $ZodCheckNanoIDParams
@@ -234,8 +231,8 @@ export function _nanoid<T extends schemas.$ZodNanoID>(
234
231
  }
235
232
 
236
233
  // CUID
237
- export type $ZodCUIDParams = StringFormatParams<schemas.$ZodCUID, "when">;
238
- export type $ZodCheckCUIDParams = CheckStringFormatParams<schemas.$ZodCUID, "when">;
234
+ export type $ZodCUIDParams = StringFormatParams<schemas.$ZodCUID>;
235
+ export type $ZodCheckCUIDParams = CheckStringFormatParams<schemas.$ZodCUID>;
239
236
  export function _cuid<T extends schemas.$ZodCUID>(
240
237
  Class: util.SchemaClass<T>,
241
238
  params?: string | $ZodCUIDParams | $ZodCheckCUIDParams
@@ -250,8 +247,8 @@ export function _cuid<T extends schemas.$ZodCUID>(
250
247
  }
251
248
 
252
249
  // CUID2
253
- export type $ZodCUID2Params = StringFormatParams<schemas.$ZodCUID2, "when">;
254
- export type $ZodCheckCUID2Params = CheckStringFormatParams<schemas.$ZodCUID2, "when">;
250
+ export type $ZodCUID2Params = StringFormatParams<schemas.$ZodCUID2>;
251
+ export type $ZodCheckCUID2Params = CheckStringFormatParams<schemas.$ZodCUID2>;
255
252
  export function _cuid2<T extends schemas.$ZodCUID2>(
256
253
  Class: util.SchemaClass<T>,
257
254
  params?: string | $ZodCUID2Params | $ZodCheckCUID2Params
@@ -266,8 +263,8 @@ export function _cuid2<T extends schemas.$ZodCUID2>(
266
263
  }
267
264
 
268
265
  // ULID
269
- export type $ZodULIDParams = StringFormatParams<schemas.$ZodULID, "when">;
270
- export type $ZodCheckULIDParams = CheckStringFormatParams<schemas.$ZodULID, "when">;
266
+ export type $ZodULIDParams = StringFormatParams<schemas.$ZodULID>;
267
+ export type $ZodCheckULIDParams = CheckStringFormatParams<schemas.$ZodULID>;
271
268
  export function _ulid<T extends schemas.$ZodULID>(
272
269
  Class: util.SchemaClass<T>,
273
270
  params?: string | $ZodULIDParams | $ZodCheckULIDParams
@@ -282,8 +279,8 @@ export function _ulid<T extends schemas.$ZodULID>(
282
279
  }
283
280
 
284
281
  // XID
285
- export type $ZodXIDParams = StringFormatParams<schemas.$ZodXID, "when">;
286
- export type $ZodCheckXIDParams = CheckStringFormatParams<schemas.$ZodXID, "when">;
282
+ export type $ZodXIDParams = StringFormatParams<schemas.$ZodXID>;
283
+ export type $ZodCheckXIDParams = CheckStringFormatParams<schemas.$ZodXID>;
287
284
  export function _xid<T extends schemas.$ZodXID>(
288
285
  Class: util.SchemaClass<T>,
289
286
  params?: string | $ZodXIDParams | $ZodCheckXIDParams
@@ -298,8 +295,8 @@ export function _xid<T extends schemas.$ZodXID>(
298
295
  }
299
296
 
300
297
  // KSUID
301
- export type $ZodKSUIDParams = StringFormatParams<schemas.$ZodKSUID, "when">;
302
- export type $ZodCheckKSUIDParams = CheckStringFormatParams<schemas.$ZodKSUID, "when">;
298
+ export type $ZodKSUIDParams = StringFormatParams<schemas.$ZodKSUID>;
299
+ export type $ZodCheckKSUIDParams = CheckStringFormatParams<schemas.$ZodKSUID>;
303
300
  export function _ksuid<T extends schemas.$ZodKSUID>(
304
301
  Class: util.SchemaClass<T>,
305
302
  params?: string | $ZodKSUIDParams | $ZodCheckKSUIDParams
@@ -313,9 +310,25 @@ export function _ksuid<T extends schemas.$ZodKSUID>(
313
310
  });
314
311
  }
315
312
 
313
+ // IP
314
+ // export type $ZodIPParams = StringFormatParams<schemas.$ZodIP, "pattern">;
315
+ // export type $ZodCheckIPParams = CheckStringFormatParams<schemas.$ZodIP, "pattern">;
316
+ // export function _ip<T extends schemas.$ZodIP>(
317
+ // Class: util.SchemaClass<T>,
318
+ // params?: string | $ZodIPParams | $ZodCheckIPParams
319
+ // ): T {
320
+ // return new Class({
321
+ // type: "string",
322
+ // format: "ip",
323
+ // check: "string_format",
324
+ // abort: false,
325
+ // ...util.normalizeParams(params),
326
+ // });
327
+ // }
328
+
316
329
  // IPv4
317
- export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
318
- export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
330
+ export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern">;
331
+ export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern">;
319
332
  export function _ipv4<T extends schemas.$ZodIPv4>(
320
333
  Class: util.SchemaClass<T>,
321
334
  params?: string | $ZodIPv4Params | $ZodCheckIPv4Params
@@ -330,8 +343,8 @@ export function _ipv4<T extends schemas.$ZodIPv4>(
330
343
  }
331
344
 
332
345
  // IPv6
333
- export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
334
- export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
346
+ export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern">;
347
+ export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern">;
335
348
  export function _ipv6<T extends schemas.$ZodIPv6>(
336
349
  Class: util.SchemaClass<T>,
337
350
  params?: string | $ZodIPv6Params | $ZodCheckIPv6Params
@@ -346,8 +359,8 @@ export function _ipv6<T extends schemas.$ZodIPv6>(
346
359
  }
347
360
 
348
361
  // CIDRv4
349
- export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
350
- export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
362
+ export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern">;
363
+ export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern">;
351
364
  export function _cidrv4<T extends schemas.$ZodCIDRv4>(
352
365
  Class: util.SchemaClass<T>,
353
366
  params?: string | $ZodCIDRv4Params | $ZodCheckCIDRv4Params
@@ -362,8 +375,8 @@ export function _cidrv4<T extends schemas.$ZodCIDRv4>(
362
375
  }
363
376
 
364
377
  // CIDRv6
365
- export type $ZodCIDRv6Params = StringFormatParams<schemas.$ZodCIDRv6, "pattern" | "when">;
366
- export type $ZodCheckCIDRv6Params = CheckStringFormatParams<schemas.$ZodCIDRv6, "pattern" | "when">;
378
+ export type $ZodCIDRv6Params = StringFormatParams<schemas.$ZodCIDRv6, "pattern">;
379
+ export type $ZodCheckCIDRv6Params = CheckStringFormatParams<schemas.$ZodCIDRv6, "pattern">;
367
380
  export function _cidrv6<T extends schemas.$ZodCIDRv6>(
368
381
  Class: util.SchemaClass<T>,
369
382
  params?: string | $ZodCIDRv6Params | $ZodCheckCIDRv6Params
@@ -378,8 +391,8 @@ export function _cidrv6<T extends schemas.$ZodCIDRv6>(
378
391
  }
379
392
 
380
393
  // Base64
381
- export type $ZodBase64Params = StringFormatParams<schemas.$ZodBase64, "pattern" | "when">;
382
- export type $ZodCheckBase64Params = CheckStringFormatParams<schemas.$ZodBase64, "pattern" | "when">;
394
+ export type $ZodBase64Params = StringFormatParams<schemas.$ZodBase64, "pattern">;
395
+ export type $ZodCheckBase64Params = CheckStringFormatParams<schemas.$ZodBase64, "pattern">;
383
396
  export function _base64<T extends schemas.$ZodBase64>(
384
397
  Class: util.SchemaClass<T>,
385
398
  params?: string | $ZodBase64Params | $ZodCheckBase64Params
@@ -394,8 +407,8 @@ export function _base64<T extends schemas.$ZodBase64>(
394
407
  }
395
408
 
396
409
  // base64url
397
- export type $ZodBase64URLParams = StringFormatParams<schemas.$ZodBase64URL, "pattern" | "when">;
398
- export type $ZodCheckBase64URLParams = CheckStringFormatParams<schemas.$ZodBase64URL, "pattern" | "when">;
410
+ export type $ZodBase64URLParams = StringFormatParams<schemas.$ZodBase64URL, "pattern">;
411
+ export type $ZodCheckBase64URLParams = CheckStringFormatParams<schemas.$ZodBase64URL, "pattern">;
399
412
  export function _base64url<T extends schemas.$ZodBase64URL>(
400
413
  Class: util.SchemaClass<T>,
401
414
  params?: string | $ZodBase64URLParams | $ZodCheckBase64URLParams
@@ -410,8 +423,8 @@ export function _base64url<T extends schemas.$ZodBase64URL>(
410
423
  }
411
424
 
412
425
  // E164
413
- export type $ZodE164Params = StringFormatParams<schemas.$ZodE164, "when">;
414
- export type $ZodCheckE164Params = CheckStringFormatParams<schemas.$ZodE164, "when">;
426
+ export type $ZodE164Params = StringFormatParams<schemas.$ZodE164>;
427
+ export type $ZodCheckE164Params = CheckStringFormatParams<schemas.$ZodE164>;
415
428
  export function _e164<T extends schemas.$ZodE164>(
416
429
  Class: util.SchemaClass<T>,
417
430
  params?: string | $ZodE164Params | $ZodCheckE164Params
@@ -426,8 +439,8 @@ export function _e164<T extends schemas.$ZodE164>(
426
439
  }
427
440
 
428
441
  // JWT
429
- export type $ZodJWTParams = StringFormatParams<schemas.$ZodJWT, "pattern" | "when">;
430
- export type $ZodCheckJWTParams = CheckStringFormatParams<schemas.$ZodJWT, "pattern" | "when">;
442
+ export type $ZodJWTParams = StringFormatParams<schemas.$ZodJWT, "pattern">;
443
+ export type $ZodCheckJWTParams = CheckStringFormatParams<schemas.$ZodJWT, "pattern">;
431
444
  export function _jwt<T extends schemas.$ZodJWT>(
432
445
  Class: util.SchemaClass<T>,
433
446
  params?: string | $ZodJWTParams | $ZodCheckJWTParams
@@ -449,8 +462,8 @@ export const TimePrecision = {
449
462
  Microsecond: 6,
450
463
  } as const;
451
464
  // ISODateTime
452
- export type $ZodISODateTimeParams = StringFormatParams<schemas.$ZodISODateTime, "pattern" | "when">;
453
- export type $ZodCheckISODateTimeParams = CheckStringFormatParams<schemas.$ZodISODateTime, "pattern" | "when">;
465
+ export type $ZodISODateTimeParams = StringFormatParams<schemas.$ZodISODateTime, "pattern">;
466
+ export type $ZodCheckISODateTimeParams = CheckStringFormatParams<schemas.$ZodISODateTime, "pattern">;
454
467
  export function _isoDateTime<T extends schemas.$ZodISODateTime>(
455
468
  Class: util.SchemaClass<T>,
456
469
  params?: string | $ZodISODateTimeParams | $ZodCheckISODateTimeParams
@@ -467,8 +480,8 @@ export function _isoDateTime<T extends schemas.$ZodISODateTime>(
467
480
  }
468
481
 
469
482
  // ISODate
470
- export type $ZodISODateParams = StringFormatParams<schemas.$ZodISODate, "pattern" | "when">;
471
- export type $ZodCheckISODateParams = CheckStringFormatParams<schemas.$ZodISODate, "pattern" | "when">;
483
+ export type $ZodISODateParams = StringFormatParams<schemas.$ZodISODate, "pattern">;
484
+ export type $ZodCheckISODateParams = CheckStringFormatParams<schemas.$ZodISODate, "pattern">;
472
485
  export function _isoDate<T extends schemas.$ZodISODate>(
473
486
  Class: util.SchemaClass<T>,
474
487
  params?: string | $ZodISODateParams | $ZodCheckISODateParams
@@ -482,8 +495,8 @@ export function _isoDate<T extends schemas.$ZodISODate>(
482
495
  }
483
496
 
484
497
  // ISOTime
485
- export type $ZodISOTimeParams = StringFormatParams<schemas.$ZodISOTime, "pattern" | "when">;
486
- export type $ZodCheckISOTimeParams = CheckStringFormatParams<schemas.$ZodISOTime, "pattern" | "when">;
498
+ export type $ZodISOTimeParams = StringFormatParams<schemas.$ZodISOTime, "pattern">;
499
+ export type $ZodCheckISOTimeParams = CheckStringFormatParams<schemas.$ZodISOTime, "pattern">;
487
500
  export function _isoTime<T extends schemas.$ZodISOTime>(
488
501
  Class: util.SchemaClass<T>,
489
502
  params?: string | $ZodISOTimeParams | $ZodCheckISOTimeParams
@@ -498,8 +511,8 @@ export function _isoTime<T extends schemas.$ZodISOTime>(
498
511
  }
499
512
 
500
513
  // ISODuration
501
- export type $ZodISODurationParams = StringFormatParams<schemas.$ZodISODuration, "when">;
502
- export type $ZodCheckISODurationParams = CheckStringFormatParams<schemas.$ZodISODuration, "when">;
514
+ export type $ZodISODurationParams = StringFormatParams<schemas.$ZodISODuration>;
515
+ export type $ZodCheckISODurationParams = CheckStringFormatParams<schemas.$ZodISODuration>;
503
516
  export function _isoDuration<T extends schemas.$ZodISODuration>(
504
517
  Class: util.SchemaClass<T>,
505
518
  params?: string | $ZodISODurationParams | $ZodCheckISODurationParams
@@ -515,7 +528,7 @@ export function _isoDuration<T extends schemas.$ZodISODuration>(
515
528
  // Number
516
529
  export type $ZodNumberParams = TypeParams<schemas.$ZodNumber<number>, "coerce">;
517
530
  export type $ZodNumberFormatParams = CheckTypeParams<schemas.$ZodNumberFormat, "format" | "coerce">;
518
- export type $ZodCheckNumberFormatParams = CheckParams<checks.$ZodCheckNumberFormat, "format" | "when">;
531
+ export type $ZodCheckNumberFormatParams = CheckParams<checks.$ZodCheckNumberFormat, "format">;
519
532
  export function _number<T extends schemas.$ZodNumber>(
520
533
  Class: util.SchemaClass<T>,
521
534
  params?: string | $ZodNumberParams
@@ -625,7 +638,7 @@ export function _coercedBoolean<T extends schemas.$ZodBoolean>(
625
638
  // BigInt
626
639
  export type $ZodBigIntParams = TypeParams<schemas.$ZodBigInt<bigint>>;
627
640
  export type $ZodBigIntFormatParams = CheckTypeParams<schemas.$ZodBigIntFormat, "format" | "coerce">;
628
- export type $ZodCheckBigIntFormatParams = CheckParams<checks.$ZodCheckBigIntFormat, "format" | "when">;
641
+ export type $ZodCheckBigIntFormatParams = CheckParams<checks.$ZodCheckBigIntFormat, "format">;
629
642
  export function _bigint<T extends schemas.$ZodBigInt>(
630
643
  Class: util.SchemaClass<T>,
631
644
  params?: string | $ZodBigIntParams
@@ -766,9 +779,9 @@ export function _nan<T extends schemas.$ZodNaN>(Class: util.SchemaClass<T>, para
766
779
  });
767
780
  }
768
781
 
769
- // export type $ZodCheckParams = CheckParams<checks.$ZodCheck, "abort" | "when">;
782
+ // export type $ZodCheckParams = CheckParams<checks.$ZodCheck, "abort">;
770
783
 
771
- export type $ZodCheckLessThanParams = CheckParams<checks.$ZodCheckLessThan, "inclusive" | "value" | "when">;
784
+ export type $ZodCheckLessThanParams = CheckParams<checks.$ZodCheckLessThan, "inclusive" | "value">;
772
785
  export function _lt(
773
786
  value: util.Numeric,
774
787
  params?: string | $ZodCheckLessThanParams
@@ -799,7 +812,7 @@ export {
799
812
  };
800
813
 
801
814
  // ZodCheckGreaterThan
802
- export type $ZodCheckGreaterThanParams = CheckParams<checks.$ZodCheckGreaterThan, "inclusive" | "value" | "when">;
815
+ export type $ZodCheckGreaterThanParams = CheckParams<checks.$ZodCheckGreaterThan, "inclusive" | "value">;
803
816
  export function _gt(value: util.Numeric, params?: string | $ZodCheckGreaterThanParams): checks.$ZodCheckGreaterThan {
804
817
  return new checks.$ZodCheckGreaterThan({
805
818
  check: "greater_than",
@@ -843,7 +856,7 @@ export function _nonnegative(params?: string | $ZodCheckGreaterThanParams): chec
843
856
  return _gte(0, params);
844
857
  }
845
858
 
846
- export type $ZodCheckMultipleOfParams = CheckParams<checks.$ZodCheckMultipleOf, "value" | "when">;
859
+ export type $ZodCheckMultipleOfParams = CheckParams<checks.$ZodCheckMultipleOf, "value">;
847
860
  export function _multipleOf(
848
861
  value: number | bigint,
849
862
  params?: string | $ZodCheckMultipleOfParams
@@ -855,7 +868,7 @@ export function _multipleOf(
855
868
  });
856
869
  }
857
870
 
858
- export type $ZodCheckMaxSizeParams = CheckParams<checks.$ZodCheckMaxSize, "maximum" | "when">;
871
+ export type $ZodCheckMaxSizeParams = CheckParams<checks.$ZodCheckMaxSize, "maximum">;
859
872
  export function _maxSize(
860
873
  maximum: number,
861
874
  params?: string | $ZodCheckMaxSizeParams
@@ -867,7 +880,7 @@ export function _maxSize(
867
880
  });
868
881
  }
869
882
 
870
- export type $ZodCheckMinSizeParams = CheckParams<checks.$ZodCheckMinSize, "minimum" | "when">;
883
+ export type $ZodCheckMinSizeParams = CheckParams<checks.$ZodCheckMinSize, "minimum">;
871
884
  export function _minSize(
872
885
  minimum: number,
873
886
  params?: string | $ZodCheckMinSizeParams
@@ -879,7 +892,7 @@ export function _minSize(
879
892
  });
880
893
  }
881
894
 
882
- export type $ZodCheckSizeEqualsParams = CheckParams<checks.$ZodCheckSizeEquals, "size" | "when">;
895
+ export type $ZodCheckSizeEqualsParams = CheckParams<checks.$ZodCheckSizeEquals, "size">;
883
896
  export function _size(
884
897
  size: number,
885
898
  params?: string | $ZodCheckSizeEqualsParams
@@ -891,7 +904,7 @@ export function _size(
891
904
  });
892
905
  }
893
906
 
894
- export type $ZodCheckMaxLengthParams = CheckParams<checks.$ZodCheckMaxLength, "maximum" | "when">;
907
+ export type $ZodCheckMaxLengthParams = CheckParams<checks.$ZodCheckMaxLength, "maximum">;
895
908
  export function _maxLength(
896
909
  maximum: number,
897
910
  params?: string | $ZodCheckMaxLengthParams
@@ -904,7 +917,7 @@ export function _maxLength(
904
917
  return ch;
905
918
  }
906
919
 
907
- export type $ZodCheckMinLengthParams = CheckParams<checks.$ZodCheckMinLength, "minimum" | "when">;
920
+ export type $ZodCheckMinLengthParams = CheckParams<checks.$ZodCheckMinLength, "minimum">;
908
921
  export function _minLength(
909
922
  minimum: number,
910
923
  params?: string | $ZodCheckMinLengthParams
@@ -916,7 +929,7 @@ export function _minLength(
916
929
  });
917
930
  }
918
931
 
919
- export type $ZodCheckLengthEqualsParams = CheckParams<checks.$ZodCheckLengthEquals, "length" | "when">;
932
+ export type $ZodCheckLengthEqualsParams = CheckParams<checks.$ZodCheckLengthEquals, "length">;
920
933
  export function _length(
921
934
  length: number,
922
935
  params?: string | $ZodCheckLengthEqualsParams
@@ -928,7 +941,7 @@ export function _length(
928
941
  });
929
942
  }
930
943
 
931
- export type $ZodCheckRegexParams = CheckParams<checks.$ZodCheckRegex, "format" | "pattern" | "when">;
944
+ export type $ZodCheckRegexParams = CheckParams<checks.$ZodCheckRegex, "format" | "pattern">;
932
945
  export function _regex(pattern: RegExp, params?: string | $ZodCheckRegexParams): checks.$ZodCheckRegex {
933
946
  return new checks.$ZodCheckRegex({
934
947
  check: "string_format",
@@ -938,7 +951,7 @@ export function _regex(pattern: RegExp, params?: string | $ZodCheckRegexParams):
938
951
  });
939
952
  }
940
953
 
941
- export type $ZodCheckLowerCaseParams = CheckParams<checks.$ZodCheckLowerCase, "format" | "when">;
954
+ export type $ZodCheckLowerCaseParams = CheckParams<checks.$ZodCheckLowerCase, "format">;
942
955
  export function _lowercase(params?: string | $ZodCheckLowerCaseParams): checks.$ZodCheckLowerCase {
943
956
  return new checks.$ZodCheckLowerCase({
944
957
  check: "string_format",
@@ -947,7 +960,7 @@ export function _lowercase(params?: string | $ZodCheckLowerCaseParams): checks.$
947
960
  });
948
961
  }
949
962
 
950
- export type $ZodCheckUpperCaseParams = CheckParams<checks.$ZodCheckUpperCase, "format" | "when">;
963
+ export type $ZodCheckUpperCaseParams = CheckParams<checks.$ZodCheckUpperCase, "format">;
951
964
 
952
965
  export function _uppercase(params?: string | $ZodCheckUpperCaseParams): checks.$ZodCheckUpperCase {
953
966
  return new checks.$ZodCheckUpperCase({
@@ -957,7 +970,7 @@ export function _uppercase(params?: string | $ZodCheckUpperCaseParams): checks.$
957
970
  });
958
971
  }
959
972
 
960
- export type $ZodCheckIncludesParams = CheckParams<checks.$ZodCheckIncludes, "includes" | "format" | "when" | "pattern">;
973
+ export type $ZodCheckIncludesParams = CheckParams<checks.$ZodCheckIncludes, "includes" | "format" | "pattern">;
961
974
  export function _includes(includes: string, params?: string | $ZodCheckIncludesParams): checks.$ZodCheckIncludes {
962
975
  return new checks.$ZodCheckIncludes({
963
976
  check: "string_format",
@@ -966,10 +979,7 @@ export function _includes(includes: string, params?: string | $ZodCheckIncludesP
966
979
  includes,
967
980
  });
968
981
  }
969
- export type $ZodCheckStartsWithParams = CheckParams<
970
- checks.$ZodCheckStartsWith,
971
- "prefix" | "format" | "when" | "pattern"
972
- >;
982
+ export type $ZodCheckStartsWithParams = CheckParams<checks.$ZodCheckStartsWith, "prefix" | "format" | "pattern">;
973
983
  export function _startsWith(prefix: string, params?: string | $ZodCheckStartsWithParams): checks.$ZodCheckStartsWith {
974
984
  return new checks.$ZodCheckStartsWith({
975
985
  check: "string_format",
@@ -979,7 +989,7 @@ export function _startsWith(prefix: string, params?: string | $ZodCheckStartsWit
979
989
  });
980
990
  }
981
991
 
982
- export type $ZodCheckEndsWithParams = CheckParams<checks.$ZodCheckEndsWith, "suffix" | "format" | "pattern" | "when">;
992
+ export type $ZodCheckEndsWithParams = CheckParams<checks.$ZodCheckEndsWith, "suffix" | "format" | "pattern">;
983
993
 
984
994
  export function _endsWith(suffix: string, params?: string | $ZodCheckEndsWithParams): checks.$ZodCheckEndsWith {
985
995
  return new checks.$ZodCheckEndsWith({
@@ -990,7 +1000,7 @@ export function _endsWith(suffix: string, params?: string | $ZodCheckEndsWithPar
990
1000
  });
991
1001
  }
992
1002
 
993
- export type $ZodCheckPropertyParams = CheckParams<checks.$ZodCheckProperty, "property" | "schema" | "when">;
1003
+ export type $ZodCheckPropertyParams = CheckParams<checks.$ZodCheckProperty, "property" | "schema">;
994
1004
  export function _property<K extends string, T extends schemas.$ZodType>(
995
1005
  property: K,
996
1006
  schema: T,
@@ -1004,7 +1014,7 @@ export function _property<K extends string, T extends schemas.$ZodType>(
1004
1014
  });
1005
1015
  }
1006
1016
 
1007
- export type $ZodCheckMimeTypeParams = CheckParams<checks.$ZodCheckMimeType, "mime" | "when">;
1017
+ export type $ZodCheckMimeTypeParams = CheckParams<checks.$ZodCheckMimeType, "mime">;
1008
1018
  export function _mime(types: util.MimeTypes[], params?: string | $ZodCheckMimeTypeParams): checks.$ZodCheckMimeType {
1009
1019
  return new checks.$ZodCheckMimeType({
1010
1020
  check: "mime_type",
@@ -2865,10 +2865,9 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
2865
2865
  //////////////////////////////////////////
2866
2866
 
2867
2867
  // provide a fallback in case the File interface isn't provided in the environment
2868
- type _File = typeof globalThis extends { File: new (...args: any[]) => any }
2869
- ? InstanceType<typeof globalThis.File>
2870
- : {};
2871
- interface File extends _File {}
2868
+ declare global {
2869
+ interface File {}
2870
+ }
2872
2871
 
2873
2872
  export interface $ZodFileDef extends $ZodTypeDef {
2874
2873
  type: "file";
@@ -3519,7 +3518,6 @@ function handleReadonlyResult(payload: ParsePayload): ParsePayload {
3519
3518
  export interface $ZodTemplateLiteralDef extends $ZodTypeDef {
3520
3519
  type: "template_literal";
3521
3520
  parts: $ZodTemplateLiteralPart[];
3522
- format?: string | undefined;
3523
3521
  }
3524
3522
  export interface $ZodTemplateLiteralInternals<Template extends string = string>
3525
3523
  extends $ZodTypeInternals<Template, Template> {
@@ -3626,7 +3624,7 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
3626
3624
  input: payload.value,
3627
3625
  inst,
3628
3626
  code: "invalid_format",
3629
- format: def.format ?? "template_literal",
3627
+ format: "template_literal",
3630
3628
  pattern: inst._zod.pattern.source,
3631
3629
  });
3632
3630
  return payload;
@@ -1,5 +1,5 @@
1
1
  export const version = {
2
2
  major: 4,
3
3
  minor: 0,
4
- patch: 4 as number,
4
+ patch: 0 as number,
5
5
  } as const;