arktype
2.2.9 · 20 Oct 2026MIT3.4M / weekRepositoryHomepagenpmAtom feed
Your version
2.2.9 is the newest release of 2.x.
Release note
Fix an issue causing global configs to be overwritten when the primary "arktype" entry point is imported
config.ts
import { configure } from "arktype/config"
configure({ numberAllowsNaN: true })main.ts
import "./config.ts"
import { type } from "arktype"
// now correctly allows NaN
type.number.allows(Number.NaN)Previous versions of the docs mistakenly suggested this was possible in a single file. This is not the case in ESM due to hoisting. See the updated global configuration docs here.
Better ParseError when attempting to constraint a morph
Previously, attempting to directly constrain a transformed type was not a type error but gave a confusing error at runtime:
// ParseError: MinLength operand must be a string or an array (was never)
type("string.trim > 2")We've added a type error and improved the runtime error:
// TypeScript: To constrain the output of string.trim, pipe like myMorph.to('number > 0')
// ParseError: MinLength operand must be a string or an array (was a morph)
type("string.trim > 2")Fix an issue causing certain complex morph types to not infer output correctly, e.g.
const types = type.module({
From: { a: ["1", "=>", () => 2] },
Morph: ["From", "=>", e => e],
To: { a: "2" }
})
const U = types.Morph.pipe(e => e, types.To)
// was:
// (In: never) => To<{ a: 2 }>
// now fixed to:
// { a: 2 }
const out = U.assert({ a: 1 })