Packages

arktype

2.2.9 · 20 Oct 2026MIT3.4M / weekRepositoryHomepagenpmAtom feed

Your version

2.2.0

4 Mar 2026Where it was published

2.2.9 is the newest release of 2.x.

In short

10 new

Release note

The section about arktype of a note shared by several packages.

Full announcement: arktype.io/docs/blog/2.2

type.fn - Validated functions

Define functions with runtime-validated parameters and return types. Supports defaults, optionals, and variadics.

const len = type.fn("string | unknown[]", ":", "number")(s => s.length)

len("foo") // 3
len([1, 2]) // 2

Type-safe regex via arkregex

Regex literals in definitions now carry full type inference. x-prefix parses capture groups at runtime.

const T = type({
	birthday: "x/^(?<month>\\d{2})-(?<day>\\d{2})-(?<year>\\d{4})$/"
})

T.assert({ birthday: "05-21-1993" }).birthday.groups.month // "05"

@ark/json-schema - Bidirectional JSON Schema

Parse JSON Schema into ArkType Types with the new @ark/json-schema package, complementing toJsonSchema(). Thanks to @TizzySaurus.

Configurable toJsonSchema

Handle incompatibilities between ArkType and JSON Schema with granular fallback codes. Supports draft-07/draft-2020-12 targets and cyclic types.

Standard Schema as definitions

Any Standard Schema compliant validator (Zod, Valibot, etc.) can be embedded directly in ArkType definitions.

select - Deep reference introspection

Query the internal structure of a type by node kind and predicate. Use selectors to configure specific references.

Improved type.declare

Now supports morph-aware declarations via a side context, and optionality via property values.

N-ary operators

type.or, type.and, type.merge, and type.pipe accept variadic definitions.

Additional highlights

  • |> string-embeddable pipe operator

  • type.valueOf for TS enums

  • string.hex + string.regex keywords

  • Serializable ArkErrors (flatByPath, flatProblemsByPath, toJSON)

  • TraversalError replaces AggregateError

  • exactOptionalPropertyTypes config

  • ES2020 + Hermes compatibility

  • In-docs playground

  • Better JSDoc + go-to-definition

  • Cyclic unions can now discriminate on nested paths