neovim-mark@2x
Bun Logo

ArkType

Optimized runtime validation from familiar, type-safe syntax

Type-level feedback with each keystroke- no plugins or build steps required.

What awaits

Unparalleled DX

Type syntax you already know with safety and completions unlike anything you've ever seen
const  = type({
	name: "string",
	platform: "'android' | 'ios'",
	"version?": "number | s
  • number | string
  • number | symbol
"
})

Better Errors

Deeply customizable messages with great defaults
const  = user({
	name: "Alan Turing",
	platform: "enigma",
	versions: [0, "1", 0n]
})

if ( instanceof type.errors) {
	// hover summary to see validation errors
	console.error(.)
}

Clarity and Concision

Definitions are half as long, type errors are twice as readable, and hovers tell you just what really matters
// hover me
const  = type({
	name: "string",
	platform: "'android' | 'ios'",
	"versions?": "number | string)[]"
TypeScript: Unmatched ) before [] 
})

Faster... everything

100x faster than Zod and 2,000x faster than Yup at runtime, with editor performance that will remind you how autocomplete is supposed to feel
Object Validation, Node v23.6.1
(source)
ArkType ⚡ 14 nanoseconds
   Zod 👍 1397 nanoseconds
   Yup 🐌 40755 nanoseconds*
*scaling generously logarithmized

Deep Introspectability

ArkType uses set theory to understand and expose the relationships between your types at runtime the way TypeScript does at compile time
.extends("object") // true
.extends("string") // false
// true (string is narrower than unknown)
.extends({
	name: "unknown"
})
// false (string is wider than "Alan")
.extends({
	name: "'Alan'"
})

Intrinsic Optimization

Every schema is internally normalized and reduced to its purest and fastest representation
// all unions are optimally discriminated
// even if multiple/nested paths are needed
const  = type({
	kind: "'admin'",
	"powers?": "string[]"
}).or({
	kind: "'superadmin'",
	"superpowers?": "string[]"
}).or({
	kind: "'pleb'"
})

Doc up

Everything you need to know from installation to integration