zod 3.23.4 → 3.23.6

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
@@ -186,201 +186,98 @@ Sponsorship at any level is appreciated and encouraged. For individual developer
186
186
 
187
187
  #### Gold
188
188
 
189
- <table>
189
+ > This tier was just added. [Be the first Gold Sponsor!](https://github.com/sponsors/colinhacks/sponsorships?sponsor=colinhacks&tier_id=399648&preview=false)
190
+
191
+ <!-- <table>
190
192
  <tr>
191
193
  <td align="center">
192
- <a href="https://speakeasyapi.dev/" target="_blank">
193
- <img src="https://avatars.githubusercontent.com/u/91446104?s=200&v=4" width="200px;" alt="Speakeasy API" />
194
- </a>
195
- <br />
196
- <b>Speakeasy</b>
197
- <br />
198
- <a href="https://speakeasyapi.dev/" target="_blank">speakeasyapi.dev</a>
199
- <br />
200
- <p width="200px">SDKs, Terraform, Docs.<br/>Your API made enterprise-ready</p>
201
- </td>
202
- <td align="center">
203
- <a href="https://deletype.com/" target="_blank">
204
- <img src="https://avatars0.githubusercontent.com/u/15068039?s=200&v=4" width="200px;" alt="Deletype logo" />
194
+ <a href="https://www.example.com" target="_blank">
195
+ <img src="https://example.com/image.png" height="100px;" alt="XXX" />
205
196
  </a>
206
197
  <br />
207
- <b>Deletype</b>
198
+ <b>XXX</b>
208
199
  <br />
209
- <a href="https://deletype.com" target="_blank">deletype.com</a>
200
+ <a href="https://www.example.com" target="_blank">example.com</a>
210
201
  </td>
211
202
  </tr>
203
+ </table> -->
204
+
205
+ #### Silver
206
+
207
+ <table>
212
208
  <tr>
213
209
  <td align="center">
214
- <a href="https://trigger.dev/" target="_blank">
215
- <img src="https://avatars.githubusercontent.com/u/95297378?s=200&v=4" width="200px;" alt="Trigger.dev logo" />
216
- </a>
210
+ <img src="https://avatars.githubusercontent.com/u/80861386?s=200&v=4" height="45px;" alt="Cerbos" />
217
211
  <br />
218
- <b>Trigger.dev</b>
219
- <br />
220
- <a href="https://trigger.dev" target="_blank">trigger.dev</a>
221
- <br/>
222
- <p>Effortless automation for developers</p>
212
+ <a href="https://cerbos.dev/" target="_blank">Cerbos</a>
223
213
  </td>
224
214
  <td align="center">
225
- <a href="https://transloadit.com/?utm_source=zod&utm_medium=referral&utm_campaign=sponsorship&utm_content=github" target="_blank">
226
- <img src="https://avatars.githubusercontent.com/u/125754?s=200&v=4" width="200px;" alt="Transloadit logo" />
227
- </a>
215
+ <img src="https://avatars.githubusercontent.com/u/301879?s=200&v=4" height="45px;" alt="Scalar.com logo" />
228
216
  <br />
229
- <b>Transloadit</b>
230
- <br />
231
- <a href="https://transloadit.com/?utm_source=zod&utm_medium=referral&utm_campaign=sponsorship&utm_content=github" target="_blank">transloadit.com</a>
232
- <br/>
233
- <p>Simple file processing for developers</p>
217
+ <a href="https://scalar.com/" target="_blank">Scalar</a>
234
218
  </td>
235
- </tr>
236
- <tr>
237
219
  <td align="center">
238
- <a href="https://infisical.com" target="_blank">
239
- <img src="https://avatars.githubusercontent.com/u/107880645?s=200&v=4" width="200px;" alt="Infisical logo" />
240
- </a>
220
+ <img src="https://avatars.githubusercontent.com/u/91446104?s=200&v=4" height="45px;" alt="Speakeasy API" />
241
221
  <br />
242
- <b>Infisical</b>
243
- <br />
244
- <a href="https://infisical.com" target="_blank">infisical.com</a>
245
- <br/>
246
- <p>Open-source platform for secret<br/>management: sync secrets across your<br/>team/infrastructure and prevent secret leaks</p>
222
+ <a href="https://speakeasyapi.dev/" target="_blank">Speakeasy</a>
247
223
  </td>
248
224
  <td align="center">
249
- <a href="https://whop.com/" target="_blank">
250
- <img src="https://avatars.githubusercontent.com/u/91036480?s=200&v=4" width="200px;" alt="Whop logo" />
251
- </a>
252
- <br />
253
- <b>Whop</b>
225
+ <img src="https://avatars0.githubusercontent.com/u/15068039?s=200&v=4" height="45px;" alt="Deletype logo" />
254
226
  <br />
255
- <a href="https://whop.com/" target="_blank">whop.com</a>
256
- <br />
257
- <p width="200px">A marketplace for really cool internet products</p>
227
+ <a href="https://deletype.com" target="_blank">Deletype</a>
258
228
  </td>
259
- </tr>
260
- <tr>
261
229
  <td align="center">
262
- <a href="https://cryptojobslist.com/" target="_blank">
263
- <img src="https://avatars.githubusercontent.com/u/36402888?s=200&v=4" width="200px;" alt="CryptoJobsList logo" />
264
- </a>
265
- <br />
266
- <b>CryptoJobsList</b>
230
+ <img src="https://avatars.githubusercontent.com/u/95297378?s=200&v=4" height="45px;" alt="Trigger.dev logo" />
267
231
  <br />
268
- <a href="https://cryptojobslist.com/" target="_blank">cryptojobslist.com</a>
269
- <br />
270
- <p width="200px">The biggest list of crypto, blockchain and Web3 jobs</p>
232
+ <a href="https://trigger.dev" target="_blank">Trigger.dev</a>
271
233
  </td>
234
+ </tr><tr>
272
235
  <td align="center">
273
- <a href="https://plain.com/" target="_blank">
274
- <img src="https://avatars.githubusercontent.com/u/70170949?s=200&v=4" width="200px;" alt="Plain logo" />
275
- </a>
236
+ <img src="https://avatars.githubusercontent.com/u/125754?s=200&v=4" height="45px;" alt="Transloadit logo" />
276
237
  <br />
277
- <b>Plain.</b>
278
- <br />
279
- <a href="https://plain.com/" target="_blank">plain.com</a>
280
- <br />
281
- <p width="200px">How developers support their users</p>
238
+ <a href="https://transloadit.com/?utm_source=zod&utm_medium=refe
239
+ rral&utm_campaign=sponsorship&utm_content=github" target="_blank">Transloadit</a>
282
240
  </td>
283
- </tr>
284
- <tr>
285
241
  <td align="center">
286
- <a href="https://inngest.com/" target="_blank">
287
- <img src="https://avatars.githubusercontent.com/u/78935958?s=200&v=4" width="200px;" alt="Inngest logo" />
288
- </a>
242
+ <img src="https://avatars.githubusercontent.com/u/107880645?s=200&v=4" height="45px;" alt="Infisical logo" />
289
243
  <br />
290
- <b>Inngest</b>
291
- <br />
292
- <a href="https://inngest.com/" target="_blank">inngest.com</a>
293
- <br />
294
- <p width="200px">Serverless queues + durable workflows for TypeScript</p>
244
+ <a href="https://infisical.com" target="_blank">Infisical</a>
295
245
  </td>
296
246
  <td align="center">
297
- <a href="https://storyblok.com/" target="_blank">
298
- <img src="https://avatars.githubusercontent.com/u/13880908?s=200&v=4" width="200px;" alt="Storyblok CMS" />
299
- </a>
300
- <br />
301
- <b>Storyblok</b>
247
+ <img src="https://avatars.githubusercontent.com/u/91036480?s=200&v=4" height="45px;" alt="Whop logo" />
302
248
  <br />
303
- <a href="https://storyblok.com/" target="_blank">storyblok.com</a>
304
- <br />
305
- <p width="200px">The only headless CMS with a visual editor</p>
249
+ <a href="https://whop.com/" target="_blank">Whop</a>
306
250
  </td>
307
- </tr>
308
- <tr>
309
251
  <td align="center">
310
- <a href="https://mux.link/zod" target="_blank">
311
- <img src="https://avatars.githubusercontent.com/u/16199997?s=200&v=4" width="200px;" alt="Mux logo" />
312
- </a>
313
- <br />
314
- <b>Mux</b>
252
+ <img src="https://avatars.githubusercontent.com/u/36402888?s=200&v=4" height="45px;" alt="CryptoJobsList logo" />
315
253
  <br />
316
- <a href="https://mux.link/zod" target="_blank">mux.com</a>
317
- <br />
318
- <p width="200px">The internet's video infrastructure</p>
254
+ <a href="https://cryptojobslist.com/" target="_blank">CryptoJobsList</a>
319
255
  </td>
320
256
  <td align="center">
321
- <a href="https://scalar.com/" target="_blank">
322
- <img src="https://avatars.githubusercontent.com/u/301879?s=200&v=4" width="200px;" alt="Scalar.com logo" />
323
- </a>
324
- <br />
325
- <b>Scalar</b>
326
- <br />
327
- <a href="https://scalar.com/" target="_blank">scalar.com</a>
328
- <br />
329
- <p width="200px">Document, discover & test APIs with Scalar</p>
330
- </td>
331
- </tr>
332
- </table>
333
-
334
- #### Silver
335
-
336
- <table>
337
- <tr>
338
- <td align="center" colspan="2">
339
- <a href="https://www.numeric.io" target="_blank">
340
- <img src="https://i.imgur.com/kTiLtZt.png" width="250px;" alt="Numeric logo" />
341
- </a>
257
+ <img src="https://avatars.githubusercontent.com/u/70170949?s=200&v=4" height="45px;" alt="Plain logo" />
342
258
  <br />
343
- <b>Numeric</b>
344
- <br />
345
- <a href="https://www.numeric.io" target="_blank">numeric.io</a>
259
+ <a href="https://plain.com/" target="_blank">Plain.</a>
346
260
  </td>
261
+ </tr><tr>
347
262
  <td align="center">
348
- <a href="https://marcatopartners.com/" target="_blank">
349
- <img src="https://avatars.githubusercontent.com/u/84106192?s=200&v=4" width="150px;" alt="Marcato Partners" />
350
- </a>
351
- <br />
352
- <b>Marcato Partners</b>
263
+ <img src="https://avatars.githubusercontent.com/u/78935958?s=200&v=4" height="45px;" alt="Inngest logo" />
353
264
  <br />
354
- <a href="https://marcatopartners.com/" target="_blank">marcatopartners.com</a>
265
+ <a href="https://inngest.com/" target="_blank">Inngest</a>
355
266
  </td>
356
- </tr>
357
- <tr>
358
267
  <td align="center">
359
- <a href="https://interval.com" target="_blank">
360
- <img src="https://avatars.githubusercontent.com/u/67802063?s=200&v=4" width="150px;" alt="" />
361
- </a>
362
- <br />
363
- <b>Interval</b>
268
+ <img src="https://avatars.githubusercontent.com/u/13880908?s=200&v=4" height="45px;" alt="Storyblok CMS" />
364
269
  <br />
365
- <a href="https://interval.com" target="_blank">interval.com</a>
270
+ <a href="https://storyblok.com/" target="_blank">Storyblok</a>
366
271
  </td>
367
272
  <td align="center">
368
- <a href="https://seasoned.cc" target="_blank">
369
- <img src="https://avatars.githubusercontent.com/u/33913103?s=200&v=4" width="150px;" alt="" />
370
- </a>
273
+ <img src="https://avatars.githubusercontent.com/u/16199997?s=200&v=4" height="45px;" alt="Mux logo" />
371
274
  <br />
372
- <b>Seasoned Software</b>
373
- <br />
374
- <a href="https://seasoned.cc" target="_blank">seasoned.cc</a>
275
+ <a href="https://mux.link/zod" target="_blank">Mux</a>
375
276
  </td>
376
277
  <td align="center">
377
- <a href="https://www.bamboocreative.nz/" target="_blank">
378
- <img src="https://avatars.githubusercontent.com/u/41406870?v=4" width="150px;" alt="Bamboo Creative logo" />
379
- </a>
278
+ <img src="https://avatars.githubusercontent.com/u/180984?v=4" height="45px;" alt="@emreb" />
380
279
  <br />
381
- <b>Bamboo Creative</b>
382
- <br />
383
- <a href="https://www.bamboocreative.nz" target="_blank">bamboocreative.nz</a>
280
+ <a href="https://github.com/emreb" target="_blank"><code>@emreb</code></a>
384
281
  </td>
385
282
  </tr>
386
283
  </table>
@@ -389,177 +286,42 @@ Sponsorship at any level is appreciated and encouraged. For individual developer
389
286
 
390
287
  <table>
391
288
  <tr>
392
- <td align="center">
393
- <a href="https://twitter.com/flybayer" target="_blank">
394
- <img src="https://avatars2.githubusercontent.com/u/8813276?s=460&u=4ff8beb9a67b173015c4b426a92d89cab960af1b&v=4" width="100px;" alt=""/>
395
- </a>
396
- <br />
397
- <b>Brandon Bayer</b>
398
- <br/>
399
- <a href="https://twitter.com/flybayer" target="_blank">@flybayer</a>,
400
- <span>creator of <a href="https://blitzjs.com">Blitz.js</a></span>
401
- <br />
402
- </td>
403
- <td align="center">
404
- <a href="https://github.com/brabeji" target="_blank">
405
- <img src="https://avatars.githubusercontent.com/u/2237954?v=4" width="100px;" alt=""/>
406
- </a>
407
- <br />
408
- <b>Jiří Brabec</b>
409
- <br/>
410
- <a href="https://github.com/brabeji" target="_blank">@brabeji</a>
411
- <br />
412
- </td>
413
- <td align="center">
414
- <a href="https://twitter.com/alexdotjs" target="_blank">
415
- <img src="https://avatars.githubusercontent.com/u/459267?v=4" width="100px;" alt="" />
416
- </a>
417
- <br />
418
- <b>Alex Johansson</b>
419
- <br />
420
- <a href="https://twitter.com/alexdotjs" target="_blank">@alexdotjs</a>
421
- </td>
289
+ <td><a href="https://www.numeric.io">Numeric</a></td>
290
+ <td><a href="https://marcatopartners.com/">Marcato Partners</a></td>
291
+ <td><a href="https://interval.com">Interval</a></td>
292
+ <td><a href="https://seasoned.cc">Seasoned Software</a></td>
422
293
  </tr>
423
294
  <tr>
424
- <td align="center">
425
- <a href="https://fungible.systems/" target="_blank">
426
- <img src="https://avatars.githubusercontent.com/u/80220121?s=200&v=4" width="100px;" alt="Fungible Systems logo"/>
427
- </a>
428
- <br />
429
- <b>Fungible Systems</b>
430
- <br/>
431
- <a href="https://fungible.systems/" target="_blank">fungible.systems</a>
432
- <br />
433
- </td>
434
- <td align="center">
435
- <a href="https://adaptable.io/" target="_blank">
436
- <img src="https://avatars.githubusercontent.com/u/60378268?s=200&v=4" width="100px;" alt=""/>
437
- </a>
438
- <br />
439
- <b>Adaptable</b>
440
- <br/>
441
- <a href="https://adaptable.io/" target="_blank">adaptable.io</a>
442
- <br />
443
- </td>
444
- <td align="center">
445
- <a href="https://www.avanawallet.com/" target="_blank">
446
- <img src="https://avatars.githubusercontent.com/u/105452197?s=200&v=4" width="100px;" alt="Avana Wallet logo"/>
447
- </a>
448
- <br />
449
- <b>Avana Wallet</b>
450
- <br/>
451
- <a href="https://www.avanawallet.com/" target="_blank">avanawallet.com</a><br/>
452
- <span>Solana non-custodial wallet</span>
453
- <br />
454
- </td>
295
+ <td><a href="https://www.bamboocreative.nz/">Bamboo Creative</a></td>
455
296
  </tr>
297
+ </table>
298
+
299
+ #### Copper
300
+
301
+ <table>
456
302
  <tr>
457
- <td align="center">
458
- <a href="https://learnwithjason.dev" target="_blank">
459
- <img src="https://avatars.githubusercontent.com/u/66575486?s=200&v=4" width="100px;" alt="Learn with Jason logo"/>
460
- </a>
461
- <br />
462
- <b>Jason Lengstorf</b>
463
- <br/>
464
- <a href="https://learnwithjason.dev/" target="_blank">learnwithjason.dev</a>
465
- <br />
466
- </td>
467
- <td align="center">
468
- <a href="https://ill.inc/" target="_blank">
469
- <img src="https://avatars.githubusercontent.com/u/89107581?s=200&v=4" width="100px;" alt="Global Illumination"/>
470
- </a>
471
- <br />
472
- <b>Global Illumination, Inc.</b>
473
- <br/>
474
- <a href="https://ill.inc/" target="_blank">ill.inc</a>
475
- <br />
476
- </td>
477
- <td align="center">
478
- <a href="https://www.masterborn.com/career?utm_source=github&utm_medium=referral&utm_campaign=zodsponsoring" target="_blank">
479
- <img src="https://avatars.githubusercontent.com/u/48984031?s=200&v=4" width="100px;" alt="MasterBorn logo"/>
480
- </a>
481
- <br />
482
- <b>MasterBorn</b>
483
- <br/>
484
- <a href="https://www.masterborn.com/career?utm_source=github&utm_medium=referral&utm_campaign=zodsponsoring" target="_blank">masterborn.com</a>
485
- <br />
486
- </td>
303
+ <td>Brandon Bayer</td>
304
+ <td>Jiří Brabec</td>
305
+ <td>Alex Johansson</td>
306
+ <td>Fungible Systems</td>
487
307
  </tr>
488
308
  <tr>
489
- <td align="center">
490
- <a href="https://github.com/kronodeus" target="_blank">
491
- <img src="https://avatars.githubusercontent.com/u/18314366?v=4" width="100px;" alt="Ryan Palmer"/>
492
- </a>
493
- <br />
494
- <b>Ryan Palmer</b>
495
- <br/>
496
- <a href="https://github.com/kronodeus" target="_blank">@kronodeus</a>
497
- <br />
498
- </td>
499
- <td align="center">
500
- <a href="https://github.com/overthemike" target="_blank">
501
- <img src="https://avatars.githubusercontent.com/u/223509?v=4" width="100px;" alt="Michael Sweeney"/>
502
- </a>
503
- <br />
504
- <b>Michael Sweeney</b>
505
- <br/>
506
- <a href="https://github.com/overthemike" target="_blank">@overthemike</a>
507
- <br />
508
- </td>
509
- <td align="center">
510
- <a href="https://usenextbase.com/" target="_blank">
511
- <img src="https://pbs.twimg.com/profile_images/1692236063409070080/28yXFtop_400x400.jpg" width="100px;" alt="Nextbase logo"/>
512
- </a>
513
- <br />
514
- <b>Nextbase</b>
515
- <br/>
516
- <a href="https://usenextbase.com/" target="_blank">usenextbase.com</a>
517
- <br />
518
- </td>
309
+ <td>Adaptable</td>
310
+ <td>Avana Wallet</td>
311
+ <td>Jason Lengstorf</td>
312
+ <td>Global Illumination, Inc.</td>
519
313
  </tr>
520
314
  <tr>
521
- <td align="center">
522
- <a href="https://remotion.dev" target="_blank">
523
- <img src="https://avatars.githubusercontent.com/u/85344006" width="100px;" alt="Remotion logo"/>
524
- </a>
525
- <br />
526
- <b>Remotion</b>
527
- <br/>
528
- <a href="https://remotion.dev" target="_blank">remotion.dev</a>
529
- <br />
530
- </td>
531
- <td align="center">
532
- <a href="https://github.com/ConnorSinnott" target="_blank">
533
- <img src="https://avatars.githubusercontent.com/u/12754711?v=4" width="100px;" alt="Connor Sinnott profile"/>
534
- </a>
535
- <br />
536
- <b>Connor Sinnott</b>
537
- <br/>
538
- <a href="https://github.com/ConnorSinnott" target="_blank">@ConnorSinnott</a>
539
- <br />
540
- </td>
541
- <td align="center">
542
- <a href="https://aerabi.com/" target="_blank">
543
- <img src="https://avatars.githubusercontent.com/u/44623032?v=4" width="100px;" alt="aerabi"/>
544
- </a>
545
- <br />
546
- <b>Mohammad-Ali A'râbi</b>
547
- <br/>
548
- <a href="https://aerabi.com/" target="_blank">aerabi.com</a>
549
- <br />
550
- </td>
315
+ <td>MasterBorn</td>
316
+ <td>Ryan Palmer</td>
317
+ <td>Michael Sweeney</td>
318
+ <td>Nextbase</td>
551
319
  </tr>
552
320
  <tr>
553
- <td align="center">
554
- <a href="https://supatool.io/" target="_blank">
555
- <img src="https://github.com/colinhacks/zod/assets/3084745/d0ec96c9-bf79-494f-9caa-9233da251f55" width="100px;" alt="Supatool logo"/>
556
- </a>
557
- <br />
558
- <b>Supatool</b>
559
- <br/>
560
- <a href="https://supatool.io/" target="_blank">supatool.io</a>
561
- <br />
562
- </td>
321
+ <td>Remotion</td>
322
+ <td>Connor Sinnott</td>
323
+ <td>Mohammad-Ali A'râbi</td>
324
+ <td>Supatool</td>
563
325
  </tr>
564
326
  </table>
565
327
 
@@ -653,6 +415,7 @@ There are a growing number of tools that are built atop or support Zod natively!
653
415
  #### Utilities for Zod
654
416
 
655
417
  - [`zod_utilz`](https://github.com/JacobWeisenburger/zod_utilz): Framework agnostic utilities for Zod.
418
+ - [`zod-playground`](https://github.com/marilari88/zod-playground): A tool for learning and testing Zod schema validation functionalities. [Link](https://zod-playground.vercel.app/).
656
419
  - [`zod-sandbox`](https://github.com/nereumelo/zod-sandbox): Controlled environment for testing zod schemas. [Live demo](https://zod-sandbox.vercel.app/).
657
420
  - [`zod-dev`](https://github.com/schalkventer/zod-dev): Conditionally disables Zod runtime parsing in production.
658
421
  - [`zod-accelerator`](https://github.com/duplojs/duplojs-zod-accelerator): Accelerates Zod's throughput up to ~100x.
@@ -1957,7 +1720,9 @@ Thanks to [ggoodman](https://github.com/ggoodman) for suggesting this.
1957
1720
 
1958
1721
  ### Cyclical objects
1959
1722
 
1960
- Despite supporting recursive schemas, passing cyclical data into Zod will cause an infinite loop.
1723
+ Despite supporting recursive schemas, passing cyclical data into Zod will cause an infinite loop in some cases.
1724
+
1725
+ > To detect cyclical objects before they cause problems, consider [this approach](https://gist.github.com/colinhacks/d35825e505e635df27cc950776c5500b).
1961
1726
 
1962
1727
  ## Promises
1963
1728
 
@@ -2679,7 +2444,7 @@ Note that branded types do not affect the runtime result of `.parse`. It is a st
2679
2444
  This method returns a `ZodReadonly` schema instance that parses the input using the base schema, then calls `Object.freeze()` on the result. The inferred type is also marked as `readonly`.
2680
2445
 
2681
2446
  ```ts
2682
- const schema = z.object({ name: string }).readonly();
2447
+ const schema = z.object({ name: z.string() }).readonly();
2683
2448
  type schema = z.infer<typeof schema>;
2684
2449
  // Readonly<{name: string}>
2685
2450
 
package/lib/index.mjs CHANGED
@@ -3977,10 +3977,15 @@ class ZodPipeline extends ZodType {
3977
3977
  class ZodReadonly extends ZodType {
3978
3978
  _parse(input) {
3979
3979
  const result = this._def.innerType._parse(input);
3980
- if (isValid(result)) {
3981
- result.value = Object.freeze(result.value);
3982
- }
3983
- return result;
3980
+ const freeze = (data) => {
3981
+ if (isValid(data)) {
3982
+ data.value = Object.freeze(data.value);
3983
+ }
3984
+ return data;
3985
+ };
3986
+ return isAsync(result)
3987
+ ? result.then((data) => freeze(data))
3988
+ : freeze(result);
3984
3989
  }
3985
3990
  unwrap() {
3986
3991
  return this._def.innerType;
package/lib/index.umd.js CHANGED
@@ -3983,10 +3983,15 @@
3983
3983
  class ZodReadonly extends ZodType {
3984
3984
  _parse(input) {
3985
3985
  const result = this._def.innerType._parse(input);
3986
- if (isValid(result)) {
3987
- result.value = Object.freeze(result.value);
3988
- }
3989
- return result;
3986
+ const freeze = (data) => {
3987
+ if (isValid(data)) {
3988
+ data.value = Object.freeze(data.value);
3989
+ }
3990
+ return data;
3991
+ };
3992
+ return isAsync(result)
3993
+ ? result.then((data) => freeze(data))
3994
+ : freeze(result);
3990
3995
  }
3991
3996
  unwrap() {
3992
3997
  return this._def.innerType;
package/lib/types.d.ts CHANGED
@@ -758,7 +758,7 @@ export declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
758
758
  }
759
759
  export declare type ArrayKeys = keyof any[];
760
760
  export declare type Indices<T> = Exclude<keyof T, ArrayKeys>;
761
- export declare type EnumValues<T extends string = string> = [T, ...T[]];
761
+ export declare type EnumValues<T extends string = string> = readonly [T, ...T[]];
762
762
  export declare type Values<T extends EnumValues> = {
763
763
  [k in T[number]]: k;
764
764
  };
package/lib/types.js CHANGED
@@ -3486,10 +3486,15 @@ exports.ZodPipeline = ZodPipeline;
3486
3486
  class ZodReadonly extends ZodType {
3487
3487
  _parse(input) {
3488
3488
  const result = this._def.innerType._parse(input);
3489
- if ((0, parseUtil_1.isValid)(result)) {
3490
- result.value = Object.freeze(result.value);
3491
- }
3492
- return result;
3489
+ const freeze = (data) => {
3490
+ if ((0, parseUtil_1.isValid)(data)) {
3491
+ data.value = Object.freeze(data.value);
3492
+ }
3493
+ return data;
3494
+ };
3495
+ return (0, parseUtil_1.isAsync)(result)
3496
+ ? result.then((data) => freeze(data))
3497
+ : freeze(result);
3493
3498
  }
3494
3499
  unwrap() {
3495
3500
  return this._def.innerType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.23.4",
3
+ "version": "3.23.6",
4
4
  "author": "Colin McDonnell <colin@colinhacks.com>",
5
5
  "repository": {
6
6
  "type": "git",