Packages
Every package ArkType publishes, its entrypoints, and what to import from each.
To define and validate Types, install arktype. It has zero runtime dependencies and exposes its regex parser, schema layer, and utilities under subpaths (arktype/regex, arktype/schema, arktype/util). Each package publishes under exactly one name, the one listed here; @ark/type, @ark/regex, @ark/schema, @ark/util, @ark/json-schema and the @arktype/* names are no longer published.
| Package | Install it to | Docs |
|---|---|---|
arktype | define Types and validate data | Setup |
@ark/aot | construct your Types when you build | Precompile |
arkregex | write regular expressions with inferred types | ArkRegex |
@ark/attest | assert types and benchmark them in your tests | Attest |
@ark/fast-check | generate test data from a Type with fast-check | fast-check |
@ark/fs | nothing: it's the filesystem layer @ark/attest uses |
Editor integrations for VS Code (and its forks), JetBrains IDEs, Zed, Neovim and Helix, plus "ArkThemes" for VS Code, are on the Editor page.
arktype
| Entrypoint | Import it for |
|---|---|
arktype | everything you use day to day (below) |
arktype/codecs | codec, and the .encode every Type has once it's imported (Codecs) |
arktype/errors | installs errors: "first" and "none" (errors) |
arktype/mutatesInput | installs mutatesInput: true and "always" (mutatesInput) |
arktype/regex | regex and the Regex type (ArkRegex) |
arktype/schema | schema nodes, rootSchema, schemaScope and ArkErrors internals (Internals, not semver-stable) |
arktype/util | shared utilities used by ArkType (not semver-stable) |
arktype/runtime | what precompiled validators run on. A build resolves arktype to it; you don't import it yourself |
arktype/config | configure, before anything else from arktype is imported |
arktype/locales/en, arktype/locales/de | the en and de locales |
arktype/i18n | helpers that a locale uses: listPattern, isolate, labelOf, groupByPath, printedActualOf, describeCause, describeMissing, writeKeywordExpected |
arktype/internal, arktype/internal/*.ts | every module's exports, for tools built on ArkType. Not semver-stable. |
These entrypoints are arktype's whole public surface. Any other subpath it exports, like arktype/schema/internal, arktype/schema/issueFeatures or arktype/schema/runtime/*, is not semver-stable.
arktype is ES2022 that calls only ES2020 built-ins, so it runs wherever both are supported. CI tests it on the two latest Node LTS lines and Node's current release, Deno, Bun, Chrome and Firefox, and on the TypeScript versions Setup lists.
arktype exports:
type,scope,match,generic,declare,defineandfnto define Types, andkeywordsandark, the keywords as a module and as a scope.fromJsonSchema, which reads a JSON Schema or a Standard JSON Schema, like a Zod schema, into a Type (From JSON Schema).regex, the same functionarkregexexports.Type,ModuleandGenericto check a value withinstanceof, andHktto write a higher-kinded generic.ArkErrors,TraversalError,ParseErrorandToJsonSchemaError, the errors ArkType returns and throws,ArkError, the type of one issue, andTraversal, the type of thectxa narrow or morph receives.byPath,flatByPath,flatMessagesByPath,byAncestorPath,firstIssue,lineOfandmessageIn, which read anArkErrorsorArkError.annotatingFallback, a JSON Schema fallback, andinferred, the symbol key a Type's inferred type is declared under.- types such as
Out,Brand,Json,JsonSchema,ArkErrorCode,Locale,Scope,BaseTypeandinferDefinition/validateDefinitionfor wrappingtype.
arktype exports configure too, but importing it from there loads all of arktype first. Configure in a file of its own, and import that file before anything else:
import { configure } from "arktype/config"
configure({ onUndeclaredKey: "delete" })import "./config.ts"
import { type } from "arktype"arktype also installs an ark CLI (init, migrate, skill, and check, emit and declare via @ark/aot). Outside a project with arktype installed, invoke it as npx arktype rather than npx ark (ark on npm is an unrelated package).
Other packages
@ark/aothas an entrypoint for each way to run it:@ark/aot/unplugin(precompile.vite(),.rollup(),.webpack()and the other bundlers),@ark/aot/node(register()),@ark/aot/bun(precompile()),@ark/aot/turbopack(a loader,withPrecompile()fornext.configand@ark/aot/turbopack/runtimefor its alias) and@ark/aot/eslint(configs.recommended). Its CLI commands run throughark(ark check,ark emit,ark declare, ornpx arktype check/emit/declare), and@ark/aotitself exportsPrecompiler, whoseanalyze()the CLI and ESLint rule run. It needs Node 22.12 or later, andtypescript5.5 to 6 (or TypeScript 7.1+ viatsgoortsrs) for declarations. See Setup.arkregexexportsregex, which is also exported fromarktype, and theRegextype.@ark/attestexportsattest,bench,setupandteardown, and installs anattestCLI. Install it as a dev dependency.@ark/fast-checkexportsarkToArbitrary. It needsfast-check3 or 4 installed beside it.
@ark/fast-check and @ark/attest each peer on an exact version of arktype, and @ark/aot precompiles with the arktype it imports. Install the versions released alongside your arktype so your project doesn't load two copies of it.
arkregex also has an ./internal entrypoint like arktype's, and every package above has ./internal/*.ts deep imports. None of them are semver-stable.