From 1b712ef217bc0cd26e527f5d0280331c9b554b05 Mon Sep 17 00:00:00 2001 From: David Blass Date: Wed, 30 Sep 2026 15:54:26 -0400 Subject: [PATCH] release: arktype 2.2.6 + dependents Bumps all publishable packages and documents the changes merged since 2.2.5: - add ArkErrors.message, aliasing summary (#1671) - fix a TypeError when ctx.reject without `expected` fails in an undiscriminated union (#1668, fixes #1667) - preserve narrows on piped union branches through an intersection (#1658, fixes #1608, @ShuviSchwarze) - format times in Date descriptions independent of the default locale (#1603, fixes #1494, @WolfieLeader) #1603 changes the text of Date error messages in 24-hour locales, e.g. "14:30, January 15, 2023" is now "2:30 PM, January 15, 2023". Co-Authored-By: Claude Opus 5.5 (1M context) --- ark/attest/package.json | 2 +- ark/fast-check/package.json | 2 +- ark/fs/package.json | 2 +- ark/json-schema/package.json | 2 +- ark/regex/package.json | 2 +- ark/schema/package.json | 2 +- ark/type/CHANGELOG.md | 50 ++++++++++++++++++++++++++++++++++++ ark/type/package.json | 2 +- ark/util/package.json | 2 +- ark/util/registry.ts | 2 +- 10 files changed, 59 insertions(+), 9 deletions(-) diff --git a/ark/attest/package.json b/ark/attest/package.json index 478cc4173..0bd504621 100644 --- a/ark/attest/package.json +++ b/ark/attest/package.json @@ -1,6 +1,6 @@ { "name": "@ark/attest", - "version": "0.56.5", + "version": "0.56.6", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/fast-check/package.json b/ark/fast-check/package.json index d6dc47b4c..f59b2e810 100644 --- a/ark/fast-check/package.json +++ b/ark/fast-check/package.json @@ -1,6 +1,6 @@ { "name": "@ark/fast-check", - "version": "0.0.16", + "version": "0.0.17", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/fs/package.json b/ark/fs/package.json index 767fa1e29..15d1ae5d8 100644 --- a/ark/fs/package.json +++ b/ark/fs/package.json @@ -1,6 +1,6 @@ { "name": "@ark/fs", - "version": "0.56.4", + "version": "0.56.5", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/json-schema/package.json b/ark/json-schema/package.json index 40bb37a43..4db28e326 100644 --- a/ark/json-schema/package.json +++ b/ark/json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@ark/json-schema", - "version": "0.0.9", + "version": "0.0.10", "license": "MIT", "authors": [ { diff --git a/ark/regex/package.json b/ark/regex/package.json index 0ded04cef..5446ee80d 100644 --- a/ark/regex/package.json +++ b/ark/regex/package.json @@ -1,7 +1,7 @@ { "name": "arkregex", "description": "A drop-in replacement for new RegExp() with types", - "version": "0.0.10", + "version": "0.0.11", "license": "MIT", "repository": { "type": "git", diff --git a/ark/schema/package.json b/ark/schema/package.json index 4fa196eea..6c7d56831 100644 --- a/ark/schema/package.json +++ b/ark/schema/package.json @@ -1,6 +1,6 @@ { "name": "@ark/schema", - "version": "0.56.4", + "version": "0.56.5", "license": "MIT", "author": { "name": "David Blass", diff --git a/ark/type/CHANGELOG.md b/ark/type/CHANGELOG.md index 9901af5f0..4f541fa2e 100644 --- a/ark/type/CHANGELOG.md +++ b/ark/type/CHANGELOG.md @@ -1,5 +1,55 @@ # arktype +## 2.2.6 + +### Add `ArkErrors.message` + +`ArkErrors` now has a `message` getter returning the same human-readable string as `summary`, so code that handles a failed result like an `Error` gets a useful message instead of `undefined`: + +```ts +const out = T(data) +if (out instanceof type.errors) console.error(out.message) +``` + +### Fix a crash when `ctx.reject` without `expected` fails in a union + +Rejecting from a narrow without an `expected` value could throw a `TypeError` instead of returning errors when the failure occurred in a union that could not be discriminated: + +```ts +const T = type("string[] | Function").narrow( + (v, ctx) => Array.isArray(v) || ctx.reject({ problem: "custom" }) +) + +// previously threw "Cannot read properties of undefined (reading 'name')" +T(() => {}) +``` + +Predicate errors now have an explicit `expected` default that does not depend on the predicate being present in the error context. + +### Preserve narrows on piped union branches through an intersection + +Intersecting a union containing a piped and narrowed branch with another morph could drop that branch's narrow: + +```ts +const T = type({ + kind: "'a'", + value: type("string.numeric.parse").narrow( + (n, ctx) => n > 0 || ctx.mustBe("positive") + ) +}) + .or({ kind: "'b'" }) + .and(type("object").pipe(o => o)) + +// previously passed, now fails with "value must be positive (was -1)" +T({ kind: "a", value: "-1" }) +``` + +Thanks to @ShuviSchwarze. + +### Format times in `Date` error messages independent of locale + +Times in `Date` descriptions (e.g. `must be after 2:30 PM, January 15, 2023`) are now consistently formatted in 12-hour time rather than depending on the runtime's default locale, which previously produced output like `14:30, January 15, 2023` in 24-hour locales. Thanks to @WolfieLeader. + ## 2.2.5 ### Preserve escaped backslashes in regex literals diff --git a/ark/type/package.json b/ark/type/package.json index 66aa5b01b..e3e217e6d 100644 --- a/ark/type/package.json +++ b/ark/type/package.json @@ -1,7 +1,7 @@ { "name": "arktype", "description": "TypeScript's 1:1 validator, optimized from editor to runtime", - "version": "2.2.5", + "version": "2.2.6", "license": "MIT", "repository": { "type": "git", diff --git a/ark/util/package.json b/ark/util/package.json index 0f471ae03..b74793645 100644 --- a/ark/util/package.json +++ b/ark/util/package.json @@ -1,6 +1,6 @@ { "name": "@ark/util", - "version": "0.56.4", + "version": "0.56.5", "license": "MIT", "repository": { "type": "git", diff --git a/ark/util/registry.ts b/ark/util/registry.ts index bbc891d5d..26d46c788 100644 --- a/ark/util/registry.ts +++ b/ark/util/registry.ts @@ -8,7 +8,7 @@ import { FileConstructor, objectKindOf } from "./objectKinds.ts" // recent node versions (https://nodejs.org/api/esm.html#json-modules). // For now, we assert this matches the package.json version via a unit test. -export const arkUtilVersion = "0.56.4" +export const arkUtilVersion = "0.56.5" export const initialRegistryContents = { version: arkUtilVersion,