API Reference

ArkType

TypeScript-first runtime validation with a concise DSL that infers types and performs fast checks.

Official Documentation ↗
CompatibilityThis documentation covers version v2. Check the official docs for the latest API surface.

Installation

npmnpm install arktype

Methods

ArkType parses a concise type expression into both a validator and a matching TypeScript type.

Key Features

  • Concise string and object type syntax
  • Automatic TypeScript type inference
  • Detailed error messages with paths

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

FAQ

What do the string definitions mean?
Keywords like "string", "number", and "email" describe validators; object literals describe shapes, and arrays use brackets.
How do I see validation errors?
Use the returned .expression or inspect the ArkErrors when calling a type as a function, which yields a detailed message per path.
Is it fast for hot paths?
ArkType compiles validators once and the checks are optimized, making it competitive with hand-written guards.