TypeScript validation compiler

TypeSea

Schema in. Optimized type guard out.

Define one immutable schema, narrow unknown input safely, then choose interpreted, JIT, AOT, or boolean-only execution for each boundary.

npm install typesea
Quick start
Runtime dependencies
zero
Execution paths
plan · JIT · AOT
Module format
ESM-only
Node.js
≥ 20.19

Quick start

Schema → guard → compiled predicate.

import { compile, t, type Infer } from "typesea";

const User = t.strictObject({
    id: t.string.uuid(),
    age: t.number.int().gte(0),
    role: t.enum(["admin", "user"])
});

type User = Infer<typeof User>;
const isUser = compile(User);

if (isUser(input)) {
    input.id;
}

Execution model

One schema, explicit execution choices.

The safe path defends hostile inputs. Trusted-data modes exchange those checks for direct property reads without changing the schema API.

01 Immutable schema
02 Validation plan
03A Interpreter
03B JIT / AOT

Safe by default

Own-property descriptor reads avoid executing getters while strict objects reject undeclared own keys.

Hot-path control

Compile once, cache explicitly, or emit AOT source. Unsafe and unchecked modes remain opt-in.

Schema analysis tools

SeaFlow derives adversarial cases; SeaBreeze joins observed values into a compact inferred schema.

Measured performance

Warm-path results, with execution modes kept separate.

The chart is generated from the checked-in benchmark result. Compare safe, unsafe, unchecked, interpreted, and ecosystem paths as different contracts.

Apple M4 Node v24.13.0 V8 13.6.233.17-node.37 median · 3 runs

Valid object · boolean guard

Operations per second · warmed median

Valid object · boolean guard
ValidatorOperations per second
TS interpreted420592
TS safe5103157
TS unsafe33092344
TS unchecked40373998
Zod1291315
Valibot1279777
Ajv4219206

Valid object · diagnostics

Operations per second · warmed median

Valid object · diagnostics
ValidatorOperations per second
TS interpreted417305
TS safe4319802
TS unsafe27269601
TS unchecked33987147
Zod1282523
Valibot1204020
Ajv4262427

Invalid object · fast-fail

Operations per second · warmed median

Invalid object · fast-fail
ValidatorOperations per second
TS interpreted3095730
TS safe42378094
TS unsafe50016548
TS unchecked50468276
Zod82542
Valibot928058
Ajv29102274

Invalid object · diagnostics

Operations per second · warmed median

Invalid object · diagnostics
ValidatorOperations per second
TS interpreted35271
TS safe1983296
TS unsafe2830517
TS unchecked3352127
Zod76309
Valibot895002
Ajv29650288
Methodology and raw data

Existing Zod-shaped code

Try the compatibility facade without rewriting the call site.

The facade is documented as a compatibility layer, while TypeSea-native builders expose compiler and analysis features directly.

API reference
// Existing import
import { z } from "zod";

// Compatibility experiment
import { z } from "typesea/v4";

const User = z.object({
    id: z.string().uuid(),
    email: z.string().email()
}).strict();

Documentation library

Every maintained guide, organized by task.

The site renders the root README and every English and Korean Markdown source during the SvelteKit build.

README

Project goals, quick start, execution modes, benchmarks, and release workflow.

API reference

Builders, guards, decoders, compilation, adapters, JSON Schema, and Result contracts.

Zod compatibility

Support levels, compilation boundaries, migration policy, and explicit gaps.

Zod compatibility corpus

Pinned public-source API counts and replacement compilation diagnostics.

AOT bundler plugin

Vite, Rollup, and esbuild integration for build-time validator emission.

SeaFlow fuzzer

Schema-directed boundary, structural, and hostile-input case generation.

SeaBreeze inference

Arena-backed principal joins that infer compact schemas from observed values.

SeaCurrent planner

Adaptive edge and path profiling, verified CDC checks, scheduling, and incremental region analysis.

Project direction

Compiler-first identity, product layers, non-goals, and the release bar.

Engine notes

Hot-path rules, validation IR, compiler behavior, recursion, and benchmark scope.

Release gate

Documentation, public API, package contents, tests, and benchmarks are checked before publishing.

pnpm verify · npm run release:check