TypeScript
VSCode
Intellij
Neovim
ArkType
TypeScript's 1:1 validator, optimized from editor to runtime
Documentation
JavaScript
Chromium
Bun
Node

ArkType is a runtime validation library that can infer TypeScript definitions 1:1 and reuse them as highly-optimized validators for your data.

With each character you type, you'll get immediate feedback from your editor in the form of either a fully-inferred Type or a specific and helpful ParseError.

This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message - no plugins required.

Isomorphic
Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.
const user = type({
  name: "string",
  device: {
    platform: "'android'|'ios'",
    "version?": "number",
  },
});


// Hover to infer...
type User = typeof user.infer;
Isomorphic
Optimized
Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.
// Hover to see internal representation...
export const deepLeftOrRight = union(
    {
        auto: {
            discriminated: "'left'"
        }
    },
    {
        auto: {
            discriminated: "'right'"
        }
    }
)
Optimized
// Hover to see internal representation...
export const numericIntersection = type(
    "(1 <= number%2 < 100) & (0 < number%3 <= 99)"
)
Concise
Say more with less
// Hover to infer...
const arkUser = type({
  name: /^ark.*$/ as Infer<`ark${string}`>,
  birthday: morph("string", (s) => new Date(s)),
  "powerLevel?": "1<=number<9000",
});
Concise
// Hover to infer...
const zodUser = z.object({
    name: z.custom<`zod${string}`>(
        (val) => typeof val === "string" && /^zod.*$/.test(val)
    ),
    birthday: z.preprocess(
        (arg) => (typeof arg === "string" ? new Date(arg) : undefined),
        z.date()
    ),
    powerLevel: z.number().gte(1).lt(9000).optional()
})
Type-safe
String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.