- Warn (
dropped-narrow) when structural operations ("...",.merge(),.pick(),.omit(),.partial(),.required(),.map(), and their generic/string-syntax equivalents) drop a root.narrow()or.filter()predicate: immediately chaining.narrow()/.filter()silences the warning, JSON Schema internal predicates are skipped, individual sites can suppress via// @ark-allow-drop-narrow//* @ark-allow-drop-narrow */in all comment layouts, and the check can be disabled globally viadroppedNarrow: false(--no-dropped-narrow/ ESLint option) (#1730). - Fixed 9 standalone validator soundness, crash,
actual, and.label()parity bugs, plus added standalone support for#1752joined delete-only unions,#1811bound units, and#1785numeric array index paths. - Precompile
fromJsonSchemaobject schemas in standalone builds, classifyfromJsonSchemaas Type-returning (exportKindOf, eliminating spurious R4 errors on validated outputs and~standard.jsonSchema), allowObject.freeze/seal/preventExtensionson Types, and supportlineOf()viaarktype/runtime. - Moved Turbopack pre-read units from
node_modules/.bin/.arktonode_modules/.cache/ark-units(#1766). - Added
--jsontoark check(including structured JSON on stdout for pre-check failures) and-v/--version; supported solution-styletsconfig.jsonfiles (files: []withreferences) inark declareacrosstsjs,tsgo, andtsrswith topological ordering, in-memory.d.tsoverlay, omitted compositerootDirdefault, intermediate solution config diagnostics,module: "nodenext"resolution fallback,.mts/.ctsdual-export resolution, identifier/destructured default exports, overloaded function signatures, and boundedShapePrinter.settle; decoupled@ark/aot/unplugin.d.tsfrom the TypeScript 6 compiler API (fixing TS 7skipLibCheck: false); standardized remaining CLI error wording toark check/ark emit/ark declare(#1781, #1777, #1766). - Hardened join/forwarding pruning soundness, esbuild/builtin ENOENT handling,
Array.from/String.rawevaluation, unpluginbuildEnd(error)guard, symlinkedcwd/config realpath canonicalization, Node loader filesystem path checks, ESLint rule resilience & LRU caching, and cache validation (#1781).
Fixed R4 false positives on reads of Type-named properties like .label and .message where the build can prove no Type reaches the value, and closed an interface inheritance soundness gap:
- Callbacks passed as props or render-prop children of resolved JSX components read their parameter types from the component's prop annotations, explicit JSX type arguments (
<Comp<Item>>) and covariant sibling props (items={options}), while still refusing components that pass a Type or spread opaque props. - Reads guarded by
typeof x === "object"(or any other non-functiontypeof),typeof x !== "function"orArray.isArray(x)on an un-reassigned binding are narrowed out as Types, since every Type and standalone validator is callable. - Generic type aliases and interfaces now bind their type arguments (
Box<Item>),typeofqueries resolve local block/function bindings as well as module-level ones, conditional types withoutinferand nested indexed accesses (Config["headers"][number]) evaluate their branches/elements, method signatures in interfaces and type literals (reset(): void) read their return types instead of marking the object opaque, objects holding functions that return opaque data keepopaqueinstead of escalating tounknown, andinterface Sub extends Basenow checks inherited members so a Type held inBaseis no longer missed.
Removed the standalone arktype-precompile binary; all precompiler CLI commands now run through ark (ark check, ark emit, ark declare, or npx arktype check/emit/declare).
A standalone validator writes a .label()'s messages and summary lines as arktype does.
Reading an error off a Type chained from a keyword type holds, like type.string.matching(/^\d+$/, "Digits only") or type.number.moreThan(0, "Enter an amount"), no longer fails the build with R4: result.issues[0]?.message reads message, which a standalone validator lacks. The build read type.string as a Module's member, which may be any arktype value, so it couldn't tell what calling the chained Type returned from a Type. type("string").matching(...) was never affected.
A standalone build fails where a narrow or morph passes ctx.reject() or ctx.error() a key its validator's error leaves out: meta, or any key past those it reads where no code is passed, as in ctx.reject({ flags: FLAG, message: "Must be unique." }). arktype's error keeps every key it's passed, while a standalone validator's is written only from code, the path keys, data, expected, description, actual and message, so a program reading issue.flags found it in development and silently didn't in production. A code's own context, like rule for code: "minLength", which its type requires, still builds. A runtime island or runtime: "arktype" keeps every key, as before.
A webpack or Rspack compiler releases its precompiler worker once it closes, and a Vite dev server once it closes. A production build that failed never reached the hook releasing it, and a dev server's never did, so a process running several, like a test runner or a dev server restarting for a changed config, held a worker of about 150 MB for each until it exited.
byPath, flatByPath, flatMessagesByPath and byAncestorPath precompile: arktype/runtime exports them, and they read a validator's errors as they read arktype's, keying each path as arktype writes it, like items[0].id. A build with runtime: "arktype/runtime" failed where code called one, asking for it to be rewritten over out.issues. messageIn, which writes a locale, still fails the build.
regex from arktype or arktype/regex builds a pattern known only at runtime, like regex(source, "i"), outside a definition: the build writes each call, and each regex.as call, as new RegExp(source, "i"), saving a call, and arktype/runtime exports regex for a read that isn't a call, like [regex]. A standalone build failed on either.
An annotation of a readonly array, like issues: readonly ArkError[], tells the build what its elements are, as ArkError[] does, so reading issue.message in for (const issue of issues) no longer fails as a read off what may be a Type.
arktype-precompile --check also checks each script outside the current directory that one it checks imports, as a bundler transforms it, like a workspace package's source linked into node_modules. It reported every definition accepted where the build failed on a read in such a module.
Shadow mode passes arktype a value written as a shorthand property under its key, so Contact.merge({ address }) no longer compares against arktype validating a key named for the placeholder, like $arkh0, and reporting it missing.
A build stores what it scanned in node_modules/.cache/ark only once it ends, so one killed partway, as by Ctrl-C, leaves nothing the next build reads. A later build was served such a scan, then scanned the program again for the check the killed build never stored, and failed with "scanned this build's program unlike an earlier build did" wherever files changed in between, as a package install relinking node_modules changes them. A build whose files change while it builds now fails saying so, rather than asking for a report.
Initial release: constructs arktype definitions at build time, so arktype's parser never ships (#810). It runs as a bundler plugin, as Node, Bun and Turbopack drivers, as arktype-precompile --check, as arktype-precompile --emit over what tsc emits and as an ESLint rule, and arktype-precompile --declare emits declarations sharing one file of shapes. See the README.
With optimize: "size", as the "smallest" preset sets, and detailed errors, a build writes each node as a call to a small runtime checker that describes what it checks from its rule, and each site creates its validator in place. A module whose Types are too few to pay for the checkers' runtime is compiled instead. A Type configured with a message, like a form's field, is the checker of what it checks saying that message, at each of its sites and where its key is missing, so fields checking the same thing share one checker. A production bundle built with optimize unset whose validators, compiled, would outweigh the arktype they replace is written as optimize: "size" writes it where a browser loads it, with a warning, and only warns, naming the "smallest" preset, where the build can't tell what loads it, as with Turbopack.
A build chooses how each definition is written, where optimize chooses for all of them: schemas maps a module's path or glob, or one of its declarations as "src/money.ts#Money", to a strategy, "fastest" (as optimize: "speed" writes), "smallest" (as optimize: "size" does) or one strategies defines, and // @ark-strategy <name> before a definition chooses for it in place. So a bundle built "smallest" compiles the Types of a hot path alone, or one left compiled writes its forms as checkers. What nothing chooses for is written as the build's own options say, and a choice overrides them and the size a build chooses for a browser's bundle, whose estimate weighs only what nothing chose for. A strategy writes a definition's whole validator, the Types it composes included, so a Type composed under two strategies is written once for each. A key matching no file, naming a declaration without a definition or naming no strategy fails the build with the nearest that would do, and arktype-precompile --check prints what each definition is written with and what chose it. The options page says what chooses over what.
A validator's errors read as its Type's do: each message, expected and summary, the alternatives a union lists and the message assert throws are the text arktype writes, as a missing key's (was missing) and a pipe.try morph's (SyntaxError: ...) are, and neither writes what a value was unless actual is configured. A validator's error has no actual, though a configured message writer reads actual as arktype's does.
A production webpack or Rspack build, Next.js's webpack compilers among them, writes the same validators as an esbuild build: it builds its modules as they are, reads them, so it reads what its resolver, loaders and generated entries make of them, then builds again those it writes. It reads each module again as the loaders after its own built it, as Babel's where Next finds a Babel config, and fails where that reads what it left out, naming the module, the read and the loaders, or the loader compiling a module to CommonJS, whose reads it can't follow. A build it can't read builds each module on its own, with a warning. It reads the modules Next.js's optimizePackageImports builds a listed package's entry as, one for each set of names imported from it, as that entry's file, so a Next.js app listing its workspace packages there is still read whole. An import() of a computed specifier loads one of the modules the bundler built for the files it can name, so it keeps each member only where one of those exports a validator. A definition reading a value code the build doesn't follow may write, as what a package tsc built to CommonJS shares between its modules, is precompiled, and its validator checks the value as it's created, a list or enum read whole by a digest of its keys and values. It reads a TypeScript enum as a loader's TypeScript transform writes it. A Vite, Rollup or Rolldown build reads each module again as the transforms after its own left it, and fails where a plugin among them adds a read of what it left out, naming the module, the read, those plugins and the members that, set true, keep what the read needs, or where one changes the code it wrote for a module's validators. A read of a call's errors that no module the build read reads fails a build the same way, there and under webpack and Rspack, and a member set true keeps the errors a read of it needs.
next build with Turbopack reads its project before it writes a module, as Turbopack's loader sees one module at a time and can serve only what's on disk: export next.config through withPrecompile from @ark/aot/turbopack. Each process of its pool answers from one read, its validators held once in files under node_modules/.bin/.ark, so a route's first load and its server output no longer grow with what each module would hold of its own. Each module is checked in each layer against what the read saw, and fails where it differs. It reads as withPrecompile has Next load next.config, before Turbopack starts, writing only what changed, so Turbopack's build cache keeps from an earlier build only what the read left as it was. It reads each route, under app/build/ or app/.well-known/ too, every script under pages/ and what a link leads to, as Next routes them. Where the project can't be read, as where a Babel config or experimental.swcPlugins has Turbopack transform a module after the loader, it warns, and each module holds its own validators. Turbopack aliases @ark/schema/runtime to @ark/aot/turbopack/runtime, which the loader writes as the copy of @ark/schema's runtime the build's options load, so the aliases stay alike as the options change: Next 16.4.1 hangs a cached build past an alias removed since.
A build keeps each answer it can reuse in node_modules/.cache/ark where it runs, so a later build, dev server or Next process reads it while nothing that decided it changed: the module, each file the precompiler read and what each import resolved to, the options, and the precompiler's own code and Node. A watch build keeps its precompiler across changes, analyzing again only the modules a change reaches, and stores only what it answered before the first.
With jsonInput: true, a build trusts the objects it checks to be plain data, as JSON.parse returns, so a Type rejecting undeclared keys counts a plain object's keys rather than checking each. On moltar's benchmark, it takes 0.82x a default build's cycles on parseStrict and 0.71x on assertStrict, level with ata's ahead-of-time build on parseStrict and 0.88x its cycles on assertStrict. Data with a declared key held non-enumerable can then pass with an undeclared key, as the options page shows.
A validator bakes expression, description, json, toJSON, toJsonSchema and ~standard.jsonSchema only where the build follows it to code reading them, its dependencies' included, so the MCP SDK, the AI SDK, Elysia's OpenAPI plugin, hono-openapi and oRPC's converter get a JSON Schema with no members set, and one only validated bakes none. A build reading one module at a time, like webpack or Turbopack, bakes what each module reads of a validator it imports where it reads it. A validator stored at an object's key is followed past the helpers tsc and SWC declare in a module they emit as CommonJS, like __createBinding and _interop_require_wildcard, which read a module's exports alone, so a workspace package built to CommonJS doesn't have the build lose track of each by them. Reading one a validator lacks throws, naming the member and the setting, or reads undefined where a production bundle left out the validator's methods, which no bundle does where a define names a binding or, on webpack and Rspack, a loader after arktype's adds a read of one.
Full changelog: https://github.com/arktypeio/arktype/blob/@ark/aot@3.0.0/ark/aot/CHANGELOG.md