Vai al contenuto
verdict:

Zod 4.5.0

notable

note: la sintesi e le note di rilascio sono in inglese

warning: intervento richiesto

6 breaking changes5 punti chiave

Zod 4.5 adds z.compile() for faster parsing, but several validators now reject input they used to accept.

sintesi · solo dalle note di rilascio · claude-haiku-5-5 · prompt v7

breaking changestutte citate, ognuna con una soluzione

breaking[1]: z.iso.datetime() no longer accepts minute-precision input such as 2020-01-01T06:15Z, so seconds are required.

RFC 3339 mandates seconds. z.iso.datetime() and z.iso.datetime({ offset: true }) no longer accept minute-precision input like 2020-01-01T06:15Z. local: true still admits 2020-01-01T06:15, since an unqualified datetime is outside RFC 3339 either way. (#6457)

help: To keep accepting both forms, union the two precisions: z.union([z.iso.datetime(), z.iso.datetime({ precision: -1 })]).

breaking[2]: .min(), .max() and .length() now count Unicode code points, not UTF-16 code units, so emoji and other astral characters count differently.

.min(), .max(), and .length() counted UTF-16 code units, so z.string().max(5) rejected five emoji. They now count Unicode code points, which is what every non-JS consumer of a length bound does (Postgres, MySQL, Go, Python, and the maxLength that z.toJSONSchema() emits). .max() only loosens; .min() and .length() tighten for astral input. Graphemes are unchanged — a ZWJ sequence is still several code points. (#6441)

help: Check string length bounds that are applied to input containing emoji or other astral characters; .min() and .length() may now reject input they accepted before.

breaking[3]: A record's key schema only governs the keys that match it, and intersections with pattern-keyed records no longer reject the object's own keys.

A record's key schema now governs only the keys that match it, the way TypeScript treats an index signature. Intersecting an object with a pattern-keyed record no longer rejects the object's own keys. (#6412)

help: Review schemas that intersect an object with a record keyed by a pattern; the notes give no further migration steps, so check what the record's key schema is expected to cover.

breaking[4]: Object and record parsers now always drop a __proto__ key, and .strict() reports an own __proto__ input key as unrecognized_keys.

Object and record parsers now drop a __proto__ key whether it comes from the input, is declared by the schema, or is produced by a record key transform. A key that a record's key schema *normalizes* to __proto__ is dropped too. .strict() reports an own __proto__ input key as unrecognized_keys instead of silently swallowing it. Error formatters and both JSON Schema converters use own-property writes so a toString or constructor path segment can't walk onto Object.prototype (#6213, #6367, #6346). (#6386, #6354, #6355, #6221)

help: The notes give no migration; check whether any parsed input or schema relies on a __proto__ key being kept.

breaking[5]: z.ulid() now restricts the first character to 0 to 7, rejecting fixtures that start with a higher character or a letter.

z.ulid() restricts the first character to 0–7; anything higher overflows the 48-bit timestamp. A fixture that doesn't start with a real timestamp, such as one with a leading letter, is now rejected (#6095).

help: The notes give no migration; check any ULID fixtures or stored values whose first character is above 7.

breaking[6]: Number and bigint formats are now distinguished at the type level.

a87ac366 fix(v4)!: distinguish number and bigint formats at the type level (#6052) by @abhishek-chaudhary2003

help: The notes give no migration; check code that uses number and bigint format checks, since the types now distinguish them.

punti chiave

release-notesgithub.com/colinhacks/zod · 559 righe
  1. Zod 4.5 is now available.
  2. ```sh
  3. npm install zod@latest
  4. ```
  5. At a glance:
  6. - [`z.compile()`](#zcompile) — the flagship feature of Zod 4.5
  7. - [`z.creditCard()`](#zcreditcard) — 12–19 digits plus Luhn checksum
  8. - [`z.properties()`](#zproperties) — the multi-property counterpart to `z.property()`
  9. - [`z.deepPartial()`](#zdeeppartial)/[`.exactPartial()`](#exactpartial)
  10. - [`z.validate(): boolean`](#zvalidate) — a fast-path to verify input validity without a full parse (up to 16x faster on invalid data)
  11. - [9x reduction in memory footprint](#9x-reduction-in-schema-memory-footprint)
  12. - [New locales](https://zod.dev/error-customization#locales): Bengali (`bn`), Central Kurdish (`ckb`), Hindi (`hi`), Kannada (`kn`), Norwegian Nynorsk (`nn`), Brazilian Portuguese (`pt-BR`), Slovak (`sk`), Turkmen (`tk`)
  13. ## `z.compile()`
  14. You can now pre-compile any Zod schema using `z.compile(schema)`. This dramatically speeds up parsing performance.
  15. ```ts
  16. import * as z from "zod";
  17. const Player = z.object({
  18. username: z.string(),
  19. bio: z.string(),
  20. xp: z.number(),
  21. // ...20 more properties...
  22. });
  23. const CompiledPlayer = z.compile(Player);
  24. ```
  25. A compiled schema can be used *exactly* like an uncompiled one. There are no special rules around compiled schemas. They're just faster.
  26. ```ts
  27. Player.parse({ ... });
  28. CompiledPlayer.parse({ ... }); // ~9x faster
  29. ```
  30. On objects, arrays, and unions, this speeds up parsing by a factor of ~3–9. More complex schemas stand to benefit more than simpler ones.
  31. <picture>
  32. <source media="(prefers-color-scheme: dark)" srcset="https://zod.dev/blog/compile-speedup-dark.svg">
  33. <img alt="Time per parse on a shared nanosecond axis, standard parser as a gray bar with the compiled time as a blue bar inside it: an array of 10 objects 377 ns to 68 ns (5.5x), a 20-key object 301 ns to 38 ns (7.8x), an array of 10 strings 241 ns to 33 ns (7.3x), a union of 3 objects 190 ns to 36 ns (5.3x), a 3-element tuple 119 ns to 33 ns (3.6x), a 5-key strict object 117 ns to 32 ns (3.7x), a discriminated union 92 ns to 27 ns (3.4x), a 5-key object 76 ns to 28 ns (2.8x); up to 7.8x faster when compiled" src="https://zod.dev/blog/compile-speedup-light.svg">
  34. </picture>
  35. *Time per parse by schema type, standard parser vs compiled — lower is better ([benchmark](https://github.com/colinhacks/zod/blob/main/packages/bench/compile-matrix.ts))*
  36. Below are the Moltar benchmark results comparing Zod (compiled and uncompiled) against the [**Moltar ParseSafe**](https://github.com/moltar/typescript-runtime-type-benchmarks) bench.
  37. <picture>
  38. <source media="(prefers-color-scheme: dark)" srcset="https://zod.dev/blog/moltar-dark.svg">
  39. <img alt="Bar chart of operations per second on the moltar benchmark fixture, parseSafe category: Zod 4 compiled 47.5M, typia 45.3M, Zod 4 11.6M, valibot 1.8M, effect 1.7M, Zod 3 1.2M, arktype 152k, yup 121k" src="https://zod.dev/blog/moltar-light.svg">
  40. </picture>
  41. *Throughput on the moltar benchmark fixture (parseSafe: returns a new object with unknown keys stripped) — higher is better ([benchmark](https://github.com/moltar/typescript-runtime-type-benchmarks/pull/2329))*
  42. And the equivalent results for the Moltar AssertLoose bench. Tested against the new `z.validate(schema, input)` function (detailed later in the post).
  43. <picture>
  44. <source media="(prefers-color-scheme: dark)" srcset="https://zod.dev/blog/moltar-assertLoose-dark.svg">
  45. <img alt="Bar chart of operations per second on the moltar benchmark fixture, assertLoose category: typia 74.9M, arktype 66.2M, Zod 4 compiled 60.6M, Zod 4 6.5M, valibot 1.9M, effect 1.7M, Zod 3 1.2M, yup 124k" src="https://zod.dev/blog/moltar-assertLoose-light.svg">
  46. </picture>
  47. *Throughput on the moltar benchmark fixture (assertLoose: returns a boolean, unknown keys allowed) — higher is better ([benchmark](https://github.com/moltar/typescript-runtime-type-benchmarks/pull/2329))*
  48. Zod's entire test suite runs twice—once normally and again with auto-compilation enabled globally—to ensure perfect fidelity.
  49. <details>
  50. <summary>How it works</summary>
  51. Under the hood, `z.compile()` walks the entire schema once and produces a hyperoptimized snippet of flat, loop-free JavaScript that can validate inputs far faster than a standard runtime validator. This snippet can be executed via `new Function()` (effectively a more powerful `eval`) to serve as a fast-path validator. Schemas use this to "fast check" validity, falling back to the regular runtime logic on validation failure to provide granular error information.
  52. Take this simple `Point` schema:
  53. ```ts
  54. const Point = z.object({
  55. x: z.number(),
  56. y: z.number()
  57. });
  58. ```
  59. Here is the generated snippet for it:
  60. ```ts
  61. const isPoint = new Function("input", `
  62. if (typeof input !== "object" || input === null) return false;
  63. if (typeof input.x !== "number") return false;
  64. if (typeof input.y !== "number") return false;
  65. return true;
  66. `);
  67. isPoint({ x: 1, y: 2 }); // true
  68. isPoint({ x: "1" }); // false
  69. ```
  70. For the large majority of inputs, the generated function validates the data with the fastest logic JavaScript can express: straight-line `typeof` checks and property reads, with no interpreter in between. When it can't handle an input, Zod falls back to the standard parser.
  71. This is the function Zod generates for the `Player` schema above:
  72. ```js
  73. if (typeof input !== "object" || input === null || Array.isArray(input)) return INVALID;
  74. const v0 = input["username"];
  75. if (typeof v0 !== "string") return INVALID;
  76. const v1 = input["bio"];
  77. if (typeof v1 !== "string") return INVALID;
  78. const v2 = input["xp"];
  79. if (typeof v2 !== "number" || !Number.isFinite(v2)) return INVALID;
  80. const v3 = { "username": v0, "bio": v1, "xp": v2 };
  81. return v3;
  82. ```
  83. Armed with the power of `new Function()`, this happens in-process at runtime. There is no need to integrate with your build system.
  84. > The compiled schema is purely additive on top of the existing schema. It tacks on the pre-compiled fast path for checking valid inputs. When invalid data is detected, it returns the `INVALID` symbol to signal that parsing should fall back to the uncompiled parser. This structurally prevents subtle deviations in error reporting between compiled and uncompiled variants.
  85. </details>
  86. ### `import "zod/compile"`
  87. To compile every schema in an application, import `zod/compile` once at the top of your entry point. Every schema constructed after that import is *automatically compiled* the first time it's used to parse data.
  88. ```ts
  89. import "zod/compile"; // must come before modules that define schemas
  90. import * as z from "zod";
  91. const schema = z.object({ name: z.string() });
  92. schema.parse({ name: "ok" }); // compiled on first parse
  93. ```
  94. It also works as a Node.js CLI flag, which guarantees it runs before any module defines a schema:
  95. ```sh
  96. node --import zod/compile app.js
  97. ```
  98. Or set `preload` in [`bunfig.toml`](https://bun.com/docs/runtime/bunfig#preload) or [`nub.jsonc`](https://nubjs.com/docs/config#preload).
  99. ```jsonc
  100. {
  101. "preload": ["zod/compile"]
  102. }
  103. ```
  104. All schemas benefit to varying degrees, though complex object/tuple/array schemas benefit more than simple scalar validators.
  105. > Read the [docs](https://zod.dev/compile), or the full technical writeup: [Introducing `z.compile()`](https://zod.dev/blog/introducing-z-compile)
  106. ## `z.creditCard()`
  107. A new string format: 12–19 digits, optionally separated by single spaces or hyphens, with a valid Luhn checksum. ([#5931](https://github.com/colinhacks/zod/pull/5931))
  108. ```ts
  109. z.creditCard().parse("4111 1111 1111 1111"); // ✅
  110. z.creditCard().parse("4111 1111 1111 1112"); // ❌ bad checksum
  111. ```
  112. ## `z.properties()`
  113. The multi-property counterpart to `z.property()`. ([#5912](https://github.com/colinhacks/zod/pull/5912))
  114. ```ts
  115. const httpsUrl = z.instanceof(URL).check(
  116. ...z.properties({
  117. protocol: z.literal("https:" as string),
  118. hostname: z.string().regex(z.regexes.domain),
  119. })
  120. );
  121. httpsUrl.parse(new URL("https://example.com")); // ✅
  122. httpsUrl.parse(new URL("http://localhost")); // ❌ protocol
  123. ```
  124. ## `z.deepPartial()`
  125. Back in functional form after being removed as a method in Zod 4. ([#5928](https://github.com/colinhacks/zod/pull/5928))
  126. ```ts
  127. const Post = z.object({
  128. title: z.string(),
  129. author: z.object({ name: z.string(), email: z.string() }),
  130. });
  131. const PartialPost = z.deepPartial(Post);
  132. type PartialPost = z.output<typeof PartialPost>;
  133. // => { title?: string; author?: { name?: string; email?: string } }
  134. PartialPost.parse({ author: {} }); // ✅
  135. ```
  136. The result is still a `ZodObject`, so `.shape` and `.extend()` keep working.
  137. ## `.exactPartial()`
  138. Like `.partial()`, but wraps each field in `z.exactOptional()` instead of `z.optional()`: keys may be omitted, but an explicit `undefined` is rejected. This matches TypeScript's `Partial<>` under `exactOptionalPropertyTypes`. ([#6065](https://github.com/colinhacks/zod/pull/6065))
  139. ```ts
  140. const Recipe = z.object({ title: z.string(), servings: z.number() });
  141. const PartialRecipe = Recipe.exactPartial();
  142. PartialRecipe.parse({}); // ✅
  143. PartialRecipe.parse({ title: undefined }); // ❌
  144. ```
  145. In Zod Mini it's a top-level function: `z.exactPartial(Recipe)`.
  146. ## `z.validate()`
  147. Standalone boolean validation, in Zod, Zod Mini, and Zod Core. It answers "is this input valid?" without constructing a `ZodError`, which makes rejection cheap: on invalid input it is up to 16x faster than `.safeParse().success`. The return type is a guard on the schema's input type, and `z.validateAsync()` covers schemas with async refinements. ([#6471](https://github.com/colinhacks/zod/pull/6471))
  148. ```ts
  149. z.validate(z.string(), "hi"); // true
  150. z.validate(z.string(), 42); // false
  151. ```
  152. ## `z.input()` / `z.output()`
  153. Project a schema onto its input or output side. Useful for validating the two halves of a codec independently. ([#5928](https://github.com/colinhacks/zod/pull/5928))
  154. ```ts
  155. const isoDate = z.codec(z.iso.datetime(), z.date(), {
  156. decode: (s) => new Date(s),
  157. encode: (d) => d.toISOString(),
  158. });
  159. const Event = z.object({ name: z.string(), at: isoDate });
  160. z.input(Event).parse({ name: "launch", at: "2024-01-01T00:00:00Z" }); // ✅
  161. z.output(Event).parse({ name: "launch", at: new Date() }); // ✅
  162. ```
  163. This is a no-op on schemas not containing codecs/pipes.
  164. ## `z.toZod<T>()`
  165. A utility to define a Zod schema that agrees exactly with a static type, often one that is handwritten or externally defined. ([#5913](https://github.com/colinhacks/zod/pull/5913))
  166. ```ts
  167. type Player = { username: string; xp: number };
  168. const Player = z.toZod<Player>()(
  169. z.object({
  170. username: z.string(),
  171. xp: z.number(),
  172. })
  173. );
  174. Player.shape.username; // ZodString — the schema is returned unchanged
  175. ```
  176. ## `z.getDiscriminatedOption()`
  177. Extract a discriminated union member by discriminator value. ([#5947](https://github.com/colinhacks/zod/pull/5947))
  178. ```ts
  179. const Fruit = z.object({ type: z.literal("fruit"), seeds: z.boolean() });
  180. const Veg = z.object({ type: z.literal("vegetable"), leafy: z.boolean() });
  181. const Produce = z.discriminatedUnion("type", [Fruit, Veg]);
  182. z.getDiscriminatedOption(Produce, "fruit"); // typeof Fruit
  183. z.getDiscriminatedOption(Produce, "meat"); // ❌ TypeScript error
  184. ```
  185. ## Cyclical inputs
  186. Zod recursive schemas now support cyclical data. For bundle size reasons, Zod Mini requires you to register a memoizer explicitly. ([#6387](https://github.com/colinhacks/zod/pull/6387), [#6482](https://github.com/colinhacks/zod/pull/6482))
  187. **Zod**
  188. ```ts
  189. const Category = z.object({
  190. name: z.string(),
  191. get subcategories() {
  192. return z.array(Category);
  193. },
  194. });
  195. const input: any = { name: "root", subcategories: [] };
  196. input.subcategories.push(input);
  197. const result = Category.parse(input);
  198. result.subcategories[0] === result; // true
  199. ```
  200. **Zod Mini**
  201. ```ts
  202. // register a memoizer before defining any schemas
  203. z.config({ memoizer: z.memoizer() });
  204. const result = Category.parse(input);
  205. result.subcategories[0] === result; // true
  206. ```
  207. ## 9x reduction in schema memory footprint
  208. In Zod 4.4 a bare `z.string()` retained 7.5kb of heap. In Zod 4.5 it retains 784 bytes.
  209. <picture>
  210. <source media="(prefers-color-scheme: dark)" srcset="https://zod.dev/blog/memory-dark.svg">
  211. <img alt="Bar chart of heap retained by one schema instance, zod 4.4.3 versus 4.5: a 10-key object 82.0kb to 11.0kb, a union 17.5kb to 2.13kb, z.string().min(1) 16.7kb to 3.37kb, a record 16.4kb to 2.64kb, z.string().optional() 12.6kb to 1.50kb, an array of strings 11.2kb to 1.93kb, z.string() 7.53kb to 784b, z.number() 4.44kb to 706b. Up to 9.8x smaller than 4.4.3." src="https://zod.dev/blog/memory-light.svg">
  212. </picture>
  213. *Retained heap per schema instance, Zod 4.4.3 vs 4.5 ([benchmark](https://github.com/colinhacks/zod/blob/main/packages/bench/memory/schema-footprint.ts))*
  214. In Zod 4.4 and earlier, all schema methods were automatically bound to the instance itself. This allowed users to pluck methods from schemas without causing issues due to `this`-binding.
  215. ```ts
  216. const { parse } = z.string();
  217. parse("some data");
  218. ```
  219. A consequence of this is that each bound method allocates space on the heap; method implementations are not shared across all instances via `prototype`, as you'd expect. Zod 4.5 implements a method memoization pattern that avoids allocating bound methods until they are actually accessed.
  220. > Read the deep dive: [Reducing Zod's memory footprint by an order of magnitude](https://zod.dev/blog/reducing-memory-footprint)
  221. ## Faster failures
  222. Zod `.parse()`/`.safeParse()` instantiates a JavaScript `Error`, which captures a stack trace. In the case of validation failures, this is often much slower than the parsing logic itself. When using `.safeParse()`, Zod no longer captures this stack trace, speeding up failure-path parses by a factor of ~7.5x. ([#6316](https://github.com/colinhacks/zod/pull/6316), [#6450](https://github.com/colinhacks/zod/pull/6450))
  223. ```ts
  224. const result = Player.safeParse({ username: 42, bio: "hello", xp: 12 });
  225. result.success; // false — ~7.5x faster than Zod 4.4
  226. ```
  227. <picture>
  228. <source media="(prefers-color-scheme: dark)" srcset="https://zod.dev/blog/fail-dark.svg">
  229. <img alt="Bar chart of time per failing safeParse: zod 4.4 at 6.3 microseconds, zod 4.5 at 840 nanoseconds — 7.6x faster" src="https://zod.dev/blog/fail-light.svg">
  230. </picture>
  231. *Player schema ([benchmark](https://github.com/colinhacks/zod/blob/main/packages/bench/failing-safeparse.ts))*
  232. ## Symbol keys in `z.object()`
  233. A shape can now declare a symbol key. TypeScript tracks it: a `const` symbol infers as `unique symbol`, so `z.infer` makes the key required and checks its value type. Undeclared symbol keys are still ignored. ([#6448](https://github.com/colinhacks/zod/pull/6448))
  234. ```ts
  235. const TAG = Symbol("tag");
  236. const schema = z.object({ name: z.string(), [TAG]: z.number() });
  237. schema.parse({ name: "alice", [TAG]: 42 }); // ✅ { name: "alice", [TAG]: 42 }
  238. schema.safeParse({ name: "alice" }); // ❌ the symbol key is required
  239. ```
  240. ## Bug fixes
  241. All of these fix soundness issues, so a schema that relied on the old behavior may now reject input it used to accept.
  242. ### ⚠️ `z.iso.datetime()` requires seconds
  243. RFC 3339 mandates seconds. `z.iso.datetime()` and `z.iso.datetime({ offset: true })` no longer accept minute-precision input like `2020-01-01T06:15Z`. `local: true` still admits `2020-01-01T06:15`, since an unqualified datetime is outside RFC 3339 either way. ([#6457](https://github.com/colinhacks/zod/pull/6457))
  244. ```ts
  245. z.iso.datetime().parse("2020-01-01T06:15:00Z"); // ✅
  246. z.iso.datetime().parse("2020-01-01T06:15Z"); // ❌ was accepted in 4.4
  247. ```
  248. To accept both forms, union the two precisions:
  249. ```ts
  250. z.union([z.iso.datetime(), z.iso.datetime({ precision: -1 })]);
  251. ```
  252. ### ⚠️ String length counts code points
  253. `.min()`, `.max()`, and `.length()` counted UTF-16 code units, so `z.string().max(5)` rejected five emoji. They now count Unicode code points, which is what every non-JS consumer of a length bound does (Postgres, MySQL, Go, Python, and the `maxLength` that `z.toJSONSchema()` emits). `.max()` only loosens; `.min()` and `.length()` tighten for astral input. Graphemes are unchanged — a ZWJ sequence is still several code points. ([#6441](https://github.com/colinhacks/zod/pull/6441))
  254. ```ts
  255. z.string().max(5).parse("😀😀😀😀😀"); // was too_big, now passes
  256. z.string().min(5).parse("😀😀😀"); // was fine, now too_small
  257. ```
  258. Closes [#3355](https://github.com/colinhacks/zod/issues/3355).
  259. ### ⚠️ Record keys and intersections match TypeScript
  260. A record's key schema now governs only the keys that match it, the way TypeScript treats an index signature. Intersecting an object with a pattern-keyed record no longer rejects the object's own keys. ([#6412](https://github.com/colinhacks/zod/pull/6412))
  261. ```ts
  262. z.object({ name: z.string() })
  263. .and(z.record(z.string().regex(/^S_/), z.string()))
  264. .parse({ name: "a", S_a: "s" });
  265. // 4.4: throws invalid_key on "name"
  266. // 4.5: { name: "a", S_a: "s" }
  267. ```
  268. Separately, an `unrecognized_keys` issue no longer aborts the schema it came from, so a strict object with an extra key *and* a bad value now reports both issues instead of just the first. Closes [#2200](https://github.com/colinhacks/zod/issues/2200), [#2573](https://github.com/colinhacks/zod/issues/2573), [#4017](https://github.com/colinhacks/zod/issues/4017), [#5663](https://github.com/colinhacks/zod/issues/5663).
  269. ### ⚠️ `__proto__` is always stripped
  270. Object and record parsers now drop a `__proto__` key whether it comes from the input, is declared by the schema, or is produced by a record key transform. A key that a record's key schema *normalizes* to `__proto__` is dropped too. `.strict()` reports an own `__proto__` input key as `unrecognized_keys` instead of silently swallowing it. Error formatters and both JSON Schema converters use own-property writes so a `toString` or `constructor` path segment can't walk onto `Object.prototype` ([#6213](https://github.com/colinhacks/zod/pull/6213), [#6367](https://github.com/colinhacks/zod/pull/6367), [#6346](https://github.com/colinhacks/zod/pull/6346)). ([#6386](https://github.com/colinhacks/zod/pull/6386), [#6354](https://github.com/colinhacks/zod/pull/6354), [#6355](https://github.com/colinhacks/zod/pull/6355), [#6221](https://github.com/colinhacks/zod/pull/6221))
  271. ### ⚠️ Stricter string formats
  272. - `z.ipv6()` validated by handing the string to `new URL()`, which let `::@1\` and `::1\n` through. It now checks the address alphabet directly ([#6442](https://github.com/colinhacks/zod/pull/6442)).
  273. - `z.ulid()` restricts the first character to `0`–`7`; anything higher overflows the 48-bit timestamp. A fixture that doesn't start with a real timestamp, such as one with a leading letter, is now rejected ([#6095](https://github.com/colinhacks/zod/pull/6095)).
  274. - `z.httpUrl()` enforces the RFC 1035 length limits on the host, matching `z.hostname()` ([#6035](https://github.com/colinhacks/zod/pull/6035)).
  275. - `z.emoji()` no longer backtracks exponentially on a failed match ([#6347](https://github.com/colinhacks/zod/pull/6347)).
  276. - `z.string().includes(sub, { position: N })` emits a JSON Schema pattern that allows *at least* N leading characters, matching `String.prototype.includes` ([#6024](https://github.com/colinhacks/zod/pull/6024)).
  277. ## Commits
  278. Zod 4.5 rolls up 155 commits. Thanks to everyone who contributed: [@dokson](https://github.com/dokson), [@deepshekhardas](https://github.com/deepshekhardas), [@zirkelc](https://github.com/zirkelc), [@francisjohnjohnston-web](https://github.com/francisjohnjohnston-web), [@MerlijnW70](https://github.com/MerlijnW70), [@codinsonn](https://github.com/codinsonn), [@oimo23](https://github.com/oimo23), [@JSap0914](https://github.com/JSap0914), [@zelinewang](https://github.com/zelinewang), [@abhishek-chaudhary2003](https://github.com/abhishek-chaudhary2003), [@spokodev](https://github.com/spokodev), [@Mohammad-Faiz-Cloud-Engineer](https://github.com/Mohammad-Faiz-Cloud-Engineer), [@hamed-bavar](https://github.com/hamed-bavar), [@MGPOCKY](https://github.com/MGPOCKY), [@ChiChuRita](https://github.com/ChiChuRita), [@dinwwwh](https://github.com/dinwwwh), [@thristhart](https://github.com/thristhart), [@tsmartin9](https://github.com/tsmartin9), [@vedanshshetti](https://github.com/vedanshshetti), [@belicam](https://github.com/belicam), [@frastefanini](https://github.com/frastefanini), [@andersk](https://github.com/andersk), [@musaddiq-rafi](https://github.com/musaddiq-rafi), [@tachmyratsaparmyradov](https://github.com/tachmyratsaparmyradov), [@arvindfroi](https://github.com/arvindfroi), [@KUMachine](https://github.com/KUMachine), [@spidersouris](https://github.com/spidersouris), [@catdalfonso](https://github.com/catdalfonso), [@mneetika](https://github.com/mneetika), [@gwagjiug](https://github.com/gwagjiug), [@MahinAnowar](https://github.com/MahinAnowar), [@MaksZhukov](https://github.com/MaksZhukov), [@emmayusufu](https://github.com/emmayusufu), [@agcty](https://github.com/agcty), [@devareddy05](https://github.com/devareddy05), [@Vish05](https://github.com/Vish05), [@yamcodes](https://github.com/yamcodes), [@mattiasahlsen](https://github.com/mattiasahlsen), [@samchungy](https://github.com/samchungy), [@ozzyfromspace](https://github.com/ozzyfromspace), [@udohjeremiah](https://github.com/udohjeremiah), [@patrickwehbe](https://github.com/patrickwehbe), [@gajus](https://github.com/gajus), [@Harm-Nullix](https://github.com/Harm-Nullix), [@thwbh](https://github.com/thwbh), [@IdanGonen](https://github.com/IdanGonen), [@irfanfandi](https://github.com/irfanfandi), [@JuerGenie](https://github.com/JuerGenie), [@marcalexiei](https://github.com/marcalexiei), [@itsahmedbilal](https://github.com/itsahmedbilal), [@DucMinhNe](https://github.com/DucMinhNe), [@meliharik](https://github.com/meliharik).
  279. - [`9782f87c`](https://github.com/colinhacks/zod/commit/9782f87c) perf(v4): validate without building the output, and keep schemas out of dictionary mode ([#6480](https://github.com/colinhacks/zod/pull/6480)) by [@colinhacks](https://github.com/colinhacks)
  280. - [`773a4867`](https://github.com/colinhacks/zod/commit/773a4867) refactor(v4): declare a trait's members on $constructor ([#6478](https://github.com/colinhacks/zod/pull/6478)) by [@colinhacks](https://github.com/colinhacks)
  281. - [`68fb3f13`](https://github.com/colinhacks/zod/commit/68fb3f13) feat(v4): make z.compile() fall back instead of throwing ([#6479](https://github.com/colinhacks/zod/pull/6479)) by [@colinhacks](https://github.com/colinhacks)
  282. - [`37b01501`](https://github.com/colinhacks/zod/commit/37b01501) feat(v4): add z.isValid and z.isValidAsync ([#6471](https://github.com/colinhacks/zod/pull/6471)) by [@colinhacks](https://github.com/colinhacks)
  283. - [`749f5452`](https://github.com/colinhacks/zod/commit/749f5452) docs: add fullproduct.dev to v4 ecosystem page ([#6001](https://github.com/colinhacks/zod/pull/6001)) by [@codinsonn](https://github.com/codinsonn)
  284. - [`24cdb7fd`](https://github.com/colinhacks/zod/commit/24cdb7fd) perf(v4): close the fastpass bindings into the compiled parser ([#6464](https://github.com/colinhacks/zod/pull/6464)) by [@colinhacks](https://github.com/colinhacks)
  285. - [`8d896186`](https://github.com/colinhacks/zod/commit/8d896186) fix(v4): stop emitting a multipleOf that JSON Schema rejects ([#6468](https://github.com/colinhacks/zod/pull/6468)) by [@colinhacks](https://github.com/colinhacks)
  286. - [`43f729db`](https://github.com/colinhacks/zod/commit/43f729db) feat(v4): make a tuple's items optional with .partial() ([#6465](https://github.com/colinhacks/zod/pull/6465)) by [@colinhacks](https://github.com/colinhacks)
  287. - [`97edaf7d`](https://github.com/colinhacks/zod/commit/97edaf7d) fix(v4): don't throw from safeParse on bigint multipleOf(0n) ([#6466](https://github.com/colinhacks/zod/pull/6466)) by [@colinhacks](https://github.com/colinhacks)
  288. - [`21a6f0cb`](https://github.com/colinhacks/zod/commit/21a6f0cb) feat(v4): let z.nanoid() take a custom length ([#4004](https://github.com/colinhacks/zod/pull/4004)) by [@oimo23](https://github.com/oimo23)
  289. - [`9d5b20ef`](https://github.com/colinhacks/zod/commit/9d5b20ef) fix(v4): restrict the first ULID character to [0-7] ([#6095](https://github.com/colinhacks/zod/pull/6095)) by [@JSap0914](https://github.com/JSap0914)
  290. - [`1cf9cd09`](https://github.com/colinhacks/zod/commit/1cf9cd09) docs: record that error maps run per parse, and how to translate at render by [@colinhacks](https://github.com/colinhacks)
  291. - [`7ce3e77d`](https://github.com/colinhacks/zod/commit/7ce3e77d) fix(v4): run a wrapper's inner schema on its own payload ([#6462](https://github.com/colinhacks/zod/pull/6462)) by [@colinhacks](https://github.com/colinhacks)
  292. - [`7b612b53`](https://github.com/colinhacks/zod/commit/7b612b53) fix(v4): fold an intersection of object schemas into one object ([#6461](https://github.com/colinhacks/zod/pull/6461)) by [@colinhacks](https://github.com/colinhacks)
  293. - [`1c43b774`](https://github.com/colinhacks/zod/commit/1c43b774) docs(v4): record why the failure path is not worth compiling by [@colinhacks](https://github.com/colinhacks)
  294. - [`badf0b78`](https://github.com/colinhacks/zod/commit/badf0b78) fix(v4): build the catch context from the input that failed ([#6192](https://github.com/colinhacks/zod/pull/6192)) by [@zelinewang](https://github.com/zelinewang)
  295. - [`a87ac366`](https://github.com/colinhacks/zod/commit/a87ac366) fix(v4)!: distinguish number and bigint formats at the type level ([#6052](https://github.com/colinhacks/zod/pull/6052)) by [@abhishek-chaudhary2003](https://github.com/abhishek-chaudhary2003)
  296. - [`6726c1dd`](https://github.com/colinhacks/zod/commit/6726c1dd) docs: record what z.input and z.output do with transforms and wrappers by [@colinhacks](https://github.com/colinhacks)
  297. - [`7cfc0122`](https://github.com/colinhacks/zod/commit/7cfc0122) fix(v4): keep a wrapper's stored value only on the side it belongs to by [@colinhacks](https://github.com/colinhacks)
  298. - [`a825c1b0`](https://github.com/colinhacks/zod/commit/a825c1b0) fix(v4): empty enums and literals match nothing ([#6459](https://github.com/colinhacks/zod/pull/6459)) by [@colinhacks](https://github.com/colinhacks)
  299. - [`7c070db9`](https://github.com/colinhacks/zod/commit/7c070db9) feat(v4): expose the function schema on .implement() results ([#6267](https://github.com/colinhacks/zod/pull/6267)) by [@deepshekhardas](https://github.com/deepshekhardas)
  300. - [`3a496968`](https://github.com/colinhacks/zod/commit/3a496968) fix(v4): make record input keys optional when the value can fill them ([#6460](https://github.com/colinhacks/zod/pull/6460)) by [@colinhacks](https://github.com/colinhacks)
  301. - [`53cec2a0`](https://github.com/colinhacks/zod/commit/53cec2a0) fix(v4): resolve z.input past a preprocess transform by [@colinhacks](https://github.com/colinhacks)
  302. - [`2125d30c`](https://github.com/colinhacks/zod/commit/2125d30c) fix(v4): accept exact decimal multiples in multipleOf ([#6223](https://github.com/colinhacks/zod/pull/6223)) by [@spokodev](https://github.com/spokodev)
  303. - [`168122fc`](https://github.com/colinhacks/zod/commit/168122fc) fix(v4): carry a pipe's own checks through z.output by [@colinhacks](https://github.com/colinhacks)
  304. - [`51a1368a`](https://github.com/colinhacks/zod/commit/51a1368a) fix(v4): let the includes(position) pattern match at or after the offset ([#6024](https://github.com/colinhacks/zod/pull/6024)) by [@francisjohnjohnston-web](https://github.com/francisjohnjohnston-web)
  305. - [`72a05c4f`](https://github.com/colinhacks/zod/commit/72a05c4f) feat(v4): expose stringbool truthy/falsy/case via _zod.bag ([#6357](https://github.com/colinhacks/zod/pull/6357)) by [@hamed-bavar](https://github.com/hamed-bavar)
  306. - [`036b39f4`](https://github.com/colinhacks/zod/commit/036b39f4) fix(v4)!: require seconds once a datetime carries a Z or an offset ([#6457](https://github.com/colinhacks/zod/pull/6457)) by [@colinhacks](https://github.com/colinhacks)
  307. - [`5825605e`](https://github.com/colinhacks/zod/commit/5825605e) perf(v4): skip the eager stack capture when building a ZodError ([#6450](https://github.com/colinhacks/zod/pull/6450)) by [@colinhacks](https://github.com/colinhacks)
  308. - [`d85472c4`](https://github.com/colinhacks/zod/commit/d85472c4) feat(v4): support declared symbol keys in z.object() ([#6448](https://github.com/colinhacks/zod/pull/6448)) by [@colinhacks](https://github.com/colinhacks)
  309. - [`d4108872`](https://github.com/colinhacks/zod/commit/d4108872) fix(v4): correct the date/time format keywords in both JSON Schema directions ([#6452](https://github.com/colinhacks/zod/pull/6452)) by [@colinhacks](https://github.com/colinhacks)
  310. - [`555e5f46`](https://github.com/colinhacks/zod/commit/555e5f46) Add z.toZod helper ([#5913](https://github.com/colinhacks/zod/pull/5913)) by [@colinhacks](https://github.com/colinhacks)
  311. - [`e0e51a55`](https://github.com/colinhacks/zod/commit/e0e51a55) docs(v4): cut the compile comments down to what they explain ([#6449](https://github.com/colinhacks/zod/pull/6449)) by [@colinhacks](https://github.com/colinhacks)
  312. - [`6574e784`](https://github.com/colinhacks/zod/commit/6574e784) fix(v4): stop catch resurrecting issues an optional already resolved ([#6440](https://github.com/colinhacks/zod/pull/6440)) by [@colinhacks](https://github.com/colinhacks)
  313. - [`937b5d01`](https://github.com/colinhacks/zod/commit/937b5d01) perf(v4): prefix issue paths in place in the object JIT failure path ([#6445](https://github.com/colinhacks/zod/pull/6445)) by [@colinhacks](https://github.com/colinhacks)
  314. - [`b63db248`](https://github.com/colinhacks/zod/commit/b63db248) fix(v4): keep a memoized node's cached issues private to the cache ([#6443](https://github.com/colinhacks/zod/pull/6443)) by [@colinhacks](https://github.com/colinhacks)
  315. - [`6ec3d043`](https://github.com/colinhacks/zod/commit/6ec3d043) fix(resolution): keep pnpm's own warnings out of the attw snapshot ([#6446](https://github.com/colinhacks/zod/pull/6446)) by [@colinhacks](https://github.com/colinhacks)
  316. - [`830ba314`](https://github.com/colinhacks/zod/commit/830ba314) fix(v4): validate the address, and return the string that was validated ([#6442](https://github.com/colinhacks/zod/pull/6442)) by [@colinhacks](https://github.com/colinhacks)
  317. - [`f101d8ca`](https://github.com/colinhacks/zod/commit/f101d8ca) Preserve callsites in parse stack traces ([#5910](https://github.com/colinhacks/zod/pull/5910)) by [@colinhacks](https://github.com/colinhacks)
  318. - [`6c77d028`](https://github.com/colinhacks/zod/commit/6c77d028) feat: compact simple anyOf unions to type array in toJSONSchema ([#6339](https://github.com/colinhacks/zod/pull/6339)) by [@deepshekhardas](https://github.com/deepshekhardas)
  319. - [`28e1ebd8`](https://github.com/colinhacks/zod/commit/28e1ebd8) fix(v4): measure string length in Unicode code points ([#6441](https://github.com/colinhacks/zod/pull/6441)) by [@colinhacks](https://github.com/colinhacks)
  320. - [`060bc9f3`](https://github.com/colinhacks/zod/commit/060bc9f3) refactor: share default when-clauses for size/length checks ([#6394](https://github.com/colinhacks/zod/pull/6394)) by [@zirkelc](https://github.com/zirkelc)
  321. - [`2848177d`](https://github.com/colinhacks/zod/commit/2848177d) docs: point the flattened/formatted error deprecations at a symbol that exists by [@colinhacks](https://github.com/colinhacks)
  322. - [`3c2dee9e`](https://github.com/colinhacks/zod/commit/3c2dee9e) Add properties checks for instanceof schemas ([#5912](https://github.com/colinhacks/zod/pull/5912)) by [@colinhacks](https://github.com/colinhacks)
  323. - [`87ffeb0f`](https://github.com/colinhacks/zod/commit/87ffeb0f) fix(v4): an absent key on the middle rung supplies nothing ([#6434](https://github.com/colinhacks/zod/pull/6434)) by [@colinhacks](https://github.com/colinhacks)
  324. - [`7785fc82`](https://github.com/colinhacks/zod/commit/7785fc82) feat(v4): add z.getDiscriminatedOption ([#5947](https://github.com/colinhacks/zod/pull/5947)) by [@dokson](https://github.com/dokson)
  325. - [`0135c85a`](https://github.com/colinhacks/zod/commit/0135c85a) feat(v4): allow passing extra args to apply() ([#6337](https://github.com/colinhacks/zod/pull/6337)) by [@deepshekhardas](https://github.com/deepshekhardas)
  326. - [`ca246d26`](https://github.com/colinhacks/zod/commit/ca246d26) fix(v4): drop empty alternation branch from datetime pattern ([#6439](https://github.com/colinhacks/zod/pull/6439)) by [@colinhacks](https://github.com/colinhacks)
  327. - [`e073d55b`](https://github.com/colinhacks/zod/commit/e073d55b) docs: z.iso.datetime() accepts a subset of ISO 8601, not all of it by [@colinhacks](https://github.com/colinhacks)
  328. - [`d6ca12ae`](https://github.com/colinhacks/zod/commit/d6ca12ae) fix(v4): infer recursive getter options in discriminatedUnion ([#6422](https://github.com/colinhacks/zod/pull/6422)) by [@colinhacks](https://github.com/colinhacks)
  329. - [`dc51404b`](https://github.com/colinhacks/zod/commit/dc51404b) Add shorn to Zod Utilities ([#6398](https://github.com/colinhacks/zod/pull/6398)) by [@ChiChuRita](https://github.com/ChiChuRita)
  330. - [`580111da`](https://github.com/colinhacks/zod/commit/580111da) docs: mark AOT compilation as canary-only by [@colinhacks](https://github.com/colinhacks)
  331. - [`6b0dae79`](https://github.com/colinhacks/zod/commit/6b0dae79) docs: note that a catch callback is not islanded by [@colinhacks](https://github.com/colinhacks)
  332. - [`898c4461`](https://github.com/colinhacks/zod/commit/898c4461) refactor(v4): give the runtime and compiled code one URL implementation by [@colinhacks](https://github.com/colinhacks)
  333. - [`260e5d4b`](https://github.com/colinhacks/zod/commit/260e5d4b) fix(v4): stop islanding a catch callback, which diverged silently by [@colinhacks](https://github.com/colinhacks)
  334. - [`11c9268b`](https://github.com/colinhacks/zod/commit/11c9268b) revert(core): drop the exactOptional parse prototype from #6432 ([#6438](https://github.com/colinhacks/zod/pull/6438)) by [@colinhacks](https://github.com/colinhacks)
  335. - [`a38ab4a8`](https://github.com/colinhacks/zod/commit/a38ab4a8) fix(core): an omittable discriminator claims undefined ([#6432](https://github.com/colinhacks/zod/pull/6432)) by [@colinhacks](https://github.com/colinhacks)
  336. - [`c9ec89e0`](https://github.com/colinhacks/zod/commit/c9ec89e0) perf(core): drop the seal and the per-key WeakSet from the lazy internals ([#6435](https://github.com/colinhacks/zod/pull/6435)) by [@colinhacks](https://github.com/colinhacks)
  337. - [`3c9ca1d9`](https://github.com/colinhacks/zod/commit/3c9ca1d9) feat(json-schema): emit a root $ref when the root schema has an id ([#6029](https://github.com/colinhacks/zod/pull/6029)) by [@dinwwwh](https://github.com/dinwwwh)
  338. - [`fa77a4d7`](https://github.com/colinhacks/zod/commit/fa77a4d7) feat(v4): z.compile — ahead-of-time schema compilation ([#6085](https://github.com/colinhacks/zod/pull/6085)) by [@colinhacks](https://github.com/colinhacks)
  339. - [`f300476d`](https://github.com/colinhacks/zod/commit/f300476d) fix(v4): let a schema's error map cover its own checks' issues ([#6426](https://github.com/colinhacks/zod/pull/6426)) by [@colinhacks](https://github.com/colinhacks)
  340. - [`9f0a3d81`](https://github.com/colinhacks/zod/commit/9f0a3d81) fix(core): restore defineLazy semantics lost in the internals move ([#6429](https://github.com/colinhacks/zod/pull/6429)) by [@colinhacks](https://github.com/colinhacks)
  341. - [`604464c3`](https://github.com/colinhacks/zod/commit/604464c3) fix(locales): da/nn/no/sv called an IP address a range ([#6430](https://github.com/colinhacks/zod/pull/6430)) by [@colinhacks](https://github.com/colinhacks)
  342. - [`7378e7cd`](https://github.com/colinhacks/zod/commit/7378e7cd) fix(locales): backfill the mac and Sizable.map gaps, and pin dictionary parity ([#6427](https://github.com/colinhacks/zod/pull/6427)) by [@colinhacks](https://github.com/colinhacks)
  343. - [`b1077f05`](https://github.com/colinhacks/zod/commit/b1077f05) perf(memory): install derived internals on a per-constructor prototype ([#6415](https://github.com/colinhacks/zod/pull/6415)) by [@colinhacks](https://github.com/colinhacks)
  344. - [`ccc15144`](https://github.com/colinhacks/zod/commit/ccc15144) fix(locales): add the credit_card key to the seven locales missing it ([#6424](https://github.com/colinhacks/zod/pull/6424)) by [@colinhacks](https://github.com/colinhacks)
  345. - [`73bacbbb`](https://github.com/colinhacks/zod/commit/73bacbbb) fix(from-json-schema): drop redundant inclusive bound for draft-04 exclusive ranges ([#6022](https://github.com/colinhacks/zod/pull/6022)) by [@francisjohnjohnston-web](https://github.com/francisjohnjohnston-web)
  346. - [`86b2e6da`](https://github.com/colinhacks/zod/commit/86b2e6da) docs: list el and hr in the supported locales ([#6423](https://github.com/colinhacks/zod/pull/6423)) by [@colinhacks](https://github.com/colinhacks)
  347. - [`45fdeda5`](https://github.com/colinhacks/zod/commit/45fdeda5) fix(v4): refine optin into a three-rung ladder, retire the fallback payload flag ([#6419](https://github.com/colinhacks/zod/pull/6419)) by [@colinhacks](https://github.com/colinhacks)
  348. - [`5b34c0ce`](https://github.com/colinhacks/zod/commit/5b34c0ce) Improve Portuguese localization and add Brazilian Portuguese (pt-BR) ([#6076](https://github.com/colinhacks/zod/pull/6076)) by [@thristhart](https://github.com/thristhart)
  349. - [`dc1a40a5`](https://github.com/colinhacks/zod/commit/dc1a40a5) fix(locales): improve french translation ([#6120](https://github.com/colinhacks/zod/pull/6120)) by [@tsmartin9](https://github.com/tsmartin9)
  350. - [`0175a043`](https://github.com/colinhacks/zod/commit/0175a043) feat(locales): add Hindi and Kannada locale support ([#6315](https://github.com/colinhacks/zod/pull/6315)) by [@vedanshshetti](https://github.com/vedanshshetti)
  351. - [`536ee3b0`](https://github.com/colinhacks/zod/commit/536ee3b0) Locales: added Slovak (sk) language ([#6041](https://github.com/colinhacks/zod/pull/6041)) by [@belicam](https://github.com/belicam)
  352. - [`07b0c3d8`](https://github.com/colinhacks/zod/commit/07b0c3d8) fix: preserve explicit superRefine issue input ([#6053](https://github.com/colinhacks/zod/pull/6053)) by [@frastefanini](https://github.com/frastefanini)
  353. - [`ba98071c`](https://github.com/colinhacks/zod/commit/ba98071c) feat: add .exactPartial() to ZodObject ([#6065](https://github.com/colinhacks/zod/pull/6065)) by [@andersk](https://github.com/andersk)
  354. - [`234c407d`](https://github.com/colinhacks/zod/commit/234c407d) feat(lang): Added Bengali locale ([#5974](https://github.com/colinhacks/zod/pull/5974)) by [@musaddiq-rafi](https://github.com/musaddiq-rafi)
  355. - [`377cd9d7`](https://github.com/colinhacks/zod/commit/377cd9d7) feat(locales): add turkmen (tk) locale ([#6168](https://github.com/colinhacks/zod/pull/6168)) by [@tachmyratsaparmyradov](https://github.com/tachmyratsaparmyradov)
  356. - [`69b6bb08`](https://github.com/colinhacks/zod/commit/69b6bb08) feat(locales): add Norwegian Nynorsk (nn) locale ([#6092](https://github.com/colinhacks/zod/pull/6092)) by [@arvindfroi](https://github.com/arvindfroi)
  357. - [`33d82e6b`](https://github.com/colinhacks/zod/commit/33d82e6b) Add Central Kurdish (ckb) locale ([#6078](https://github.com/colinhacks/zod/pull/6078)) by [@KUMachine](https://github.com/KUMachine)
  358. - [`06666fe2`](https://github.com/colinhacks/zod/commit/06666fe2) fix(fr): remove hyphen in "non-optionnel" ([#5999](https://github.com/colinhacks/zod/pull/5999)) by [@spidersouris](https://github.com/spidersouris)
  359. - [`79cfedea`](https://github.com/colinhacks/zod/commit/79cfedea) feat(v4): expose the owning schema on check-originated issues ([#6420](https://github.com/colinhacks/zod/pull/6420)) by [@colinhacks](https://github.com/colinhacks)
  360. - [`436b5da8`](https://github.com/colinhacks/zod/commit/436b5da8) docs: propose compiled constructor graph by [@colinhacks](https://github.com/colinhacks)
  361. - [`eb4682c9`](https://github.com/colinhacks/zod/commit/eb4682c9) fix(json-schema): resolve tuple minItems past transform and catch in input mode ([#6418](https://github.com/colinhacks/zod/pull/6418)) by [@colinhacks](https://github.com/colinhacks)
  362. - [`4d6b5cd3`](https://github.com/colinhacks/zod/commit/4d6b5cd3) fix(json-schema): route unrepresentable default values through `unrepresentable` by [@colinhacks](https://github.com/colinhacks)
  363. - [`2abc9e05`](https://github.com/colinhacks/zod/commit/2abc9e05) docs: note that the JSON Schema emitter reads static optin ([#6417](https://github.com/colinhacks/zod/pull/6417)) by [@colinhacks](https://github.com/colinhacks)
  364. - [`578e1cd0`](https://github.com/colinhacks/zod/commit/578e1cd0) feat(v4): support format: "hostname" in fromJSONSchema ([#6305](https://github.com/colinhacks/zod/pull/6305)) by [@catdalfonso](https://github.com/catdalfonso)
  365. - [`942bf8cb`](https://github.com/colinhacks/zod/commit/942bf8cb) feat(v4): parse input containing reference cycles ([#6387](https://github.com/colinhacks/zod/pull/6387)) by [@colinhacks](https://github.com/colinhacks)
  366. - [`78b523f0`](https://github.com/colinhacks/zod/commit/78b523f0) fix(json-schema): keep preprocess object properties required in input mode ([#6133](https://github.com/colinhacks/zod/pull/6133)) by [@MerlijnW70](https://github.com/MerlijnW70)
  367. - [`973b1b44`](https://github.com/colinhacks/zod/commit/973b1b44) fix(v4): strip output-typed catch values from the input JSON Schema ([#6409](https://github.com/colinhacks/zod/pull/6409)) by [@colinhacks](https://github.com/colinhacks)
  368. - [`5e608851`](https://github.com/colinhacks/zod/commit/5e608851) feat(v4): add z.deepPartial and runtime z.input / z.output ([#5928](https://github.com/colinhacks/zod/pull/5928)) by [@dokson](https://github.com/dokson)
  369. - [`4e1720c8`](https://github.com/colinhacks/zod/commit/4e1720c8) fix(v4): align record keys and intersection strictness with TypeScript ([#6412](https://github.com/colinhacks/zod/pull/6412)) by [@colinhacks](https://github.com/colinhacks)
  370. - [`4cc4053d`](https://github.com/colinhacks/zod/commit/4cc4053d) fix: honor loose mode for closed record key schemas ([#6157](https://github.com/colinhacks/zod/pull/6157)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  371. - [`69be843f`](https://github.com/colinhacks/zod/commit/69be843f) fix(v4): stop the object JIT fastpass keeping a swallowed issue's value ([#6407](https://github.com/colinhacks/zod/pull/6407)) by [@colinhacks](https://github.com/colinhacks)
  372. - [`b899cd17`](https://github.com/colinhacks/zod/commit/b899cd17) perf(json-schema): make toJSONSchema(registry) linear in registry size ([#6408](https://github.com/colinhacks/zod/pull/6408)) by [@colinhacks](https://github.com/colinhacks)
  373. - [`6074828e`](https://github.com/colinhacks/zod/commit/6074828e) fix(v4): make fromJSONSchema propertyNames compose with the other object keywords ([#6411](https://github.com/colinhacks/zod/pull/6411)) by [@colinhacks](https://github.com/colinhacks)
  374. - [`d7b209f3`](https://github.com/colinhacks/zod/commit/d7b209f3) docs: point the Web URLs callout at z.httpUrl() ([#6410](https://github.com/colinhacks/zod/pull/6410)) by [@colinhacks](https://github.com/colinhacks)
  375. - [`611bd762`](https://github.com/colinhacks/zod/commit/611bd762) fix(mini): make merge() take an object schema, matching classic ([#6404](https://github.com/colinhacks/zod/pull/6404)) by [@colinhacks](https://github.com/colinhacks)
  376. - [`b53e53cc`](https://github.com/colinhacks/zod/commit/b53e53cc) fix(v4): use exact flag in English locale too_small/too_big messages ([#6177](https://github.com/colinhacks/zod/pull/6177)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  377. - [`421cc9a5`](https://github.com/colinhacks/zod/commit/421cc9a5) fix(json-schema): unescape JSON Pointer tokens when resolving $ref ([#6402](https://github.com/colinhacks/zod/pull/6402)) by [@colinhacks](https://github.com/colinhacks)
  378. - [`4c27fe87`](https://github.com/colinhacks/zod/commit/4c27fe87) fix(v4): give z.xor() a distinct error when multiple options match ([#6376](https://github.com/colinhacks/zod/pull/6376)) by [@colinhacks](https://github.com/colinhacks)
  379. - [`a106fbe7`](https://github.com/colinhacks/zod/commit/a106fbe7) fix(v4): make fromJSONSchema tuples open-ended by default ([#6020](https://github.com/colinhacks/zod/pull/6020)) by [@mneetika](https://github.com/mneetika)
  380. - [`e8034eba`](https://github.com/colinhacks/zod/commit/e8034eba) fix(v4): make prefixItems/draft-7 items respect minItems in fromJSONSchema ([#6201](https://github.com/colinhacks/zod/pull/6201)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  381. - [`784e5c26`](https://github.com/colinhacks/zod/commit/784e5c26) fix(v4): let bundlers tree-shake locales out of the default import ([#6384](https://github.com/colinhacks/zod/pull/6384)) by [@colinhacks](https://github.com/colinhacks)
  382. - [`97edd70a`](https://github.com/colinhacks/zod/commit/97edd70a) fix(toJSONSchema): constrain closed tuple length ([#6194](https://github.com/colinhacks/zod/pull/6194)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  383. - [`f150020d`](https://github.com/colinhacks/zod/commit/f150020d) fix(v4): escape non-string enum values in template literal patterns ([#5934](https://github.com/colinhacks/zod/pull/5934)) by [@gwagjiug](https://github.com/gwagjiug)
  384. - [`faf33a28`](https://github.com/colinhacks/zod/commit/faf33a28) fix: surface @deprecated on re-exported compat aliases ([#6072](https://github.com/colinhacks/zod/pull/6072)) by [@MahinAnowar](https://github.com/MahinAnowar)
  385. - [`3956224a`](https://github.com/colinhacks/zod/commit/3956224a) docs: state that metadata wins over generated JSON Schema keywords ([#6401](https://github.com/colinhacks/zod/pull/6401)) by [@colinhacks](https://github.com/colinhacks)
  386. - [`a1904fc2`](https://github.com/colinhacks/zod/commit/a1904fc2) fix(v4): report date origin for numeric min/max bounds ([#6129](https://github.com/colinhacks/zod/pull/6129)) by [@MerlijnW70](https://github.com/MerlijnW70)
  387. - [`bd18314c`](https://github.com/colinhacks/zod/commit/bd18314c) fix: escape JSON Pointer reserved characters in toJSONSchema $ref (closes #6027) ([#6144](https://github.com/colinhacks/zod/pull/6144)) by [@MaksZhukov](https://github.com/MaksZhukov)
  388. - [`2a5164f5`](https://github.com/colinhacks/zod/commit/2a5164f5) fix(v4): enforce RFC 1035 length limits in regexes.domain ([#6035](https://github.com/colinhacks/zod/pull/6035)) by [@emmayusufu](https://github.com/emmayusufu)
  389. - [`0e5bc4b1`](https://github.com/colinhacks/zod/commit/0e5bc4b1) fix(v4): respect additionalProperties:false with patternProperties in fromJSONSchema ([#6199](https://github.com/colinhacks/zod/pull/6199)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  390. - [`c8f06d36`](https://github.com/colinhacks/zod/commit/c8f06d36) fix(v4): clarify infinite number errors ([#5906](https://github.com/colinhacks/zod/pull/5906)) by [@colinhacks](https://github.com/colinhacks)
  391. - [`9a7ecc35`](https://github.com/colinhacks/zod/commit/9a7ecc35) fix(json-schema): accept RFC 3339 numeric offsets in date-time format ([#6298](https://github.com/colinhacks/zod/pull/6298)) by [@agcty](https://github.com/agcty)
  392. - [`0a76f3d7`](https://github.com/colinhacks/zod/commit/0a76f3d7) feat(v4): add z.creditCard() string format ([#5931](https://github.com/colinhacks/zod/pull/5931)) by [@dokson](https://github.com/dokson)
  393. - [`bd6619c0`](https://github.com/colinhacks/zod/commit/bd6619c0) feat(json-schema): accept a function for `unrepresentable` ([#6380](https://github.com/colinhacks/zod/pull/6380)) by [@colinhacks](https://github.com/colinhacks)
  394. - [`9d20fdc3`](https://github.com/colinhacks/zod/commit/9d20fdc3) fix(v4): preserve z.preprocess input narrowing ([#5967](https://github.com/colinhacks/zod/pull/5967)) by [@devareddy05](https://github.com/devareddy05)
  395. - [`3063993a`](https://github.com/colinhacks/zod/commit/3063993a) perf(v4): cut per-schema memory ~90% by moving methods to the prototype ([#6318](https://github.com/colinhacks/zod/pull/6318)) by [@zirkelc](https://github.com/zirkelc)
  396. - [`fd074106`](https://github.com/colinhacks/zod/commit/fd074106) feat(json-schema): run `override` before the unrepresentable error ([#6391](https://github.com/colinhacks/zod/pull/6391)) by [@colinhacks](https://github.com/colinhacks)
  397. - [`2715c12e`](https://github.com/colinhacks/zod/commit/2715c12e) fix(v4): preserve default English locale across tree-shaken bundles ([#5959](https://github.com/colinhacks/zod/pull/5959)) by [@colinhacks](https://github.com/colinhacks)
  398. - [`81d9fc6c`](https://github.com/colinhacks/zod/commit/81d9fc6c) docs: add zod-form-action to ecosystem ([#6314](https://github.com/colinhacks/zod/pull/6314)) by [@Vish05](https://github.com/Vish05)
  399. - [`d86df5e0`](https://github.com/colinhacks/zod/commit/d86df5e0) docs: add ArkEnv to ecosystem page ([#6203](https://github.com/colinhacks/zod/pull/6203)) by [@yamcodes](https://github.com/yamcodes)
  400. - [`18b4ff99`](https://github.com/colinhacks/zod/commit/18b4ff99) docs(ecosystem): add zodql to API Libraries ([#6227](https://github.com/colinhacks/zod/pull/6227)) by [@mattiasahlsen](https://github.com/mattiasahlsen)
  401. - [`479d6f51`](https://github.com/colinhacks/zod/commit/479d6f51) shill oxlint ([#6196](https://github.com/colinhacks/zod/pull/6196)) by [@samchungy](https://github.com/samchungy)
  402. - [`85dba7e1`](https://github.com/colinhacks/zod/commit/85dba7e1) docs: document that any/unknown object keys are required ([#6388](https://github.com/colinhacks/zod/pull/6388)) by [@colinhacks](https://github.com/colinhacks)
  403. - [`d24fb4c3`](https://github.com/colinhacks/zod/commit/d24fb4c3) fix: consistently strip __proto__ from parsed objects ([#6386](https://github.com/colinhacks/zod/pull/6386)) by [@colinhacks](https://github.com/colinhacks)
  404. - [`7708d447`](https://github.com/colinhacks/zod/commit/7708d447) perf(v4): lazy ZodError construction ([#6316](https://github.com/colinhacks/zod/pull/6316)) by [@zirkelc](https://github.com/zirkelc)
  405. - [`8ac9ae51`](https://github.com/colinhacks/zod/commit/8ac9ae51) fix(docs-v3): serve the docsify SPA fallback on Vercel ([#6378](https://github.com/colinhacks/zod/pull/6378)) by [@colinhacks](https://github.com/colinhacks)
  406. - [`31384464`](https://github.com/colinhacks/zod/commit/31384464) fix(v4): complete reserved-key hardening ([#6371](https://github.com/colinhacks/zod/pull/6371)) by [@colinhacks](https://github.com/colinhacks)
  407. - [`600c6909`](https://github.com/colinhacks/zod/commit/600c6909) docs: add Attaform to ecosystem ([#6188](https://github.com/colinhacks/zod/pull/6188)) by [@ozzyfromspace](https://github.com/ozzyfromspace)
  408. - [`37c05fa5`](https://github.com/colinhacks/zod/commit/37c05fa5) docs(ecosystem): rename zod-to-mongo-schema to zod-mongo-schema ([#6178](https://github.com/colinhacks/zod/pull/6178)) by [@udohjeremiah](https://github.com/udohjeremiah)
  409. - [`badfdf08`](https://github.com/colinhacks/zod/commit/badfdf08) docs: update keyof() ZodEnum type to the v4 form ([#6124](https://github.com/colinhacks/zod/pull/6124)) by [@patrickwehbe](https://github.com/patrickwehbe)
  410. - [`e25b68e1`](https://github.com/colinhacks/zod/commit/e25b68e1) perf(v4): let three dead declarations tree-shake under esbuild ([#6381](https://github.com/colinhacks/zod/pull/6381)) by [@colinhacks](https://github.com/colinhacks)
  411. - [`53397351`](https://github.com/colinhacks/zod/commit/53397351) docs(ecosystem): Add zod-mongoose list item in Zod To X ([#6062](https://github.com/colinhacks/zod/pull/6062)) by [@Harm-Nullix](https://github.com/Harm-Nullix)
  412. - [`dfa0deb1`](https://github.com/colinhacks/zod/commit/dfa0deb1) docs: add tauri-typegen to ecosystem ([#6032](https://github.com/colinhacks/zod/pull/6032)) by [@thwbh](https://github.com/thwbh)
  413. - [`9c914ee8`](https://github.com/colinhacks/zod/commit/9c914ee8) docs: add dynamic error message and combined refinement examples for refine() ([#6002](https://github.com/colinhacks/zod/pull/6002)) by [@IdanGonen](https://github.com/IdanGonen)
  414. - [`921649de`](https://github.com/colinhacks/zod/commit/921649de) fix(v4): formatError and treeifyError handle inherited-name path elements ([#6367](https://github.com/colinhacks/zod/pull/6367)) by [@deepshekhardas](https://github.com/deepshekhardas)
  415. - [`e7029aa4`](https://github.com/colinhacks/zod/commit/e7029aa4) fix(v4): report own __proto__ key under .strict() ([#6221](https://github.com/colinhacks/zod/pull/6221)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  416. - [`9c540db8`](https://github.com/colinhacks/zod/commit/9c540db8) fix(v4): re-check the record key after the key schema runs ([#6355](https://github.com/colinhacks/zod/pull/6355)) by [@colinhacks](https://github.com/colinhacks)
  417. - [`8bb89ea4`](https://github.com/colinhacks/zod/commit/8bb89ea4) docs: add .nonempty() to Strings, Arrays, Sets, and Maps sections ([#6056](https://github.com/colinhacks/zod/pull/6056)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  418. - [`599c0e41`](https://github.com/colinhacks/zod/commit/599c0e41) docs(ecosystem): Add `@chrock-studio/overload` and `@chrock-studio/zod-utils` ([#6040](https://github.com/colinhacks/zod/pull/6040)) by [@JuerGenie](https://github.com/JuerGenie)
  419. - [`27a9036a`](https://github.com/colinhacks/zod/commit/27a9036a) docs(ecosystem): `eslint-plugin-zod` is `eslint-zod` now ([#5975](https://github.com/colinhacks/zod/pull/5975)) by [@marcalexiei](https://github.com/marcalexiei)
  420. - [`e177a0ee`](https://github.com/colinhacks/zod/commit/e177a0ee) docs(v4): document coerce missing-key breaking change ([#5957](https://github.com/colinhacks/zod/pull/5957)) ([#5964](https://github.com/colinhacks/zod/pull/5964)) by [@dokson](https://github.com/dokson)
  421. - [`66fba964`](https://github.com/colinhacks/zod/commit/66fba964) docs: show z.instanceof with built-in classes ([#6059](https://github.com/colinhacks/zod/pull/6059)) by [@itsahmedbilal](https://github.com/itsahmedbilal)
  422. - [`2d90846a`](https://github.com/colinhacks/zod/commit/2d90846a) fix(docs): make the prefault example runnable ([#6063](https://github.com/colinhacks/zod/pull/6063)) by [@DucMinhNe](https://github.com/DucMinhNe)
  423. - [`ead9fcb3`](https://github.com/colinhacks/zod/commit/ead9fcb3) fix(v4): write a declared __proto__ key as an own property ([#6354](https://github.com/colinhacks/zod/pull/6354)) by [@colinhacks](https://github.com/colinhacks)
  424. - [`c58764c5`](https://github.com/colinhacks/zod/commit/c58764c5) docs: fix UUID helper list in v4 introduction ([#6214](https://github.com/colinhacks/zod/pull/6214)) by [@meliharik](https://github.com/meliharik)
  425. - [`f238fbd2`](https://github.com/colinhacks/zod/commit/f238fbd2) fix: remove exponential backtracking from the emoji regex ([#6347](https://github.com/colinhacks/zod/pull/6347)) by [@colinhacks](https://github.com/colinhacks)
  426. - [`e6c213ec`](https://github.com/colinhacks/zod/commit/e6c213ec) fix(json-schema): keep __proto__ keys as own properties in schema conversion ([#6346](https://github.com/colinhacks/zod/pull/6346)) by [@colinhacks](https://github.com/colinhacks)
  427. - [`573fcb75`](https://github.com/colinhacks/zod/commit/573fcb75) fix(errors): use own-property semantics in every error-tree walker ([#6213](https://github.com/colinhacks/zod/pull/6213)) by [@pullfrog[bot]](https://github.com/pullfrog[bot])
  428. - [`6f5e99fd`](https://github.com/colinhacks/zod/commit/6f5e99fd) fix(docs-v3): rename README.md to home.md so Vercel serves it by [@colinhacks](https://github.com/colinhacks)
  429. - [`bbc68f99`](https://github.com/colinhacks/zod/commit/bbc68f99) docs: soften Zod 3 EOL callouts to informational tone by [@colinhacks](https://github.com/colinhacks)
  430. - [`3fc9b25f`](https://github.com/colinhacks/zod/commit/3fc9b25f) docs: reframe library-authors page Zod-4-first; note Zod 3 EOL by [@colinhacks](https://github.com/colinhacks)
  431. - [`f29f2a6d`](https://github.com/colinhacks/zod/commit/f29f2a6d) fix(v4): cidrv6 JSON schema pattern matches runtime ([#5945](https://github.com/colinhacks/zod/pull/5945)) by [@dokson](https://github.com/dokson)
  432. - [`dfd8766b`](https://github.com/colinhacks/zod/commit/dfd8766b) fix(v4): break circular import between classic schemas and iso ([#5275](https://github.com/colinhacks/zod/pull/5275)) ([#5926](https://github.com/colinhacks/zod/pull/5926)) by [@dokson](https://github.com/dokson)
  433. - [`fbe8ad1b`](https://github.com/colinhacks/zod/commit/fbe8ad1b) fix(v4): allow dynamic `.catch()` under `unrepresentable: "any"` ([#5273](https://github.com/colinhacks/zod/pull/5273)) ([#5925](https://github.com/colinhacks/zod/pull/5925)) by [@dokson](https://github.com/dokson)

vedi su githubimported 2026-09-28 via npm