Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ark/attest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/attest",
"version": "0.56.5",
"version": "0.56.6",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/fast-check/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/fast-check",
"version": "0.0.16",
"version": "0.0.17",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/fs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/fs",
"version": "0.56.4",
"version": "0.56.5",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
2 changes: 1 addition & 1 deletion ark/json-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/json-schema",
"version": "0.0.9",
"version": "0.0.10",
"license": "MIT",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion ark/regex/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion ark/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/schema",
"version": "0.56.4",
"version": "0.56.5",
"license": "MIT",
"author": {
"name": "David Blass",
Expand Down
50 changes: 50 additions & 0 deletions ark/type/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion ark/type/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion ark/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ark/util",
"version": "0.56.4",
"version": "0.56.5",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion ark/util/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading