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 - 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.
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.
Valid object · boolean guard
Operations per second · warmed median
| Validator | Operations per second |
|---|---|
| TS interpreted | 420592 |
| TS safe | 5103157 |
| TS unsafe | 33092344 |
| TS unchecked | 40373998 |
| Zod | 1291315 |
| Valibot | 1279777 |
| Ajv | 4219206 |
Valid object · diagnostics
Operations per second · warmed median
| Validator | Operations per second |
|---|---|
| TS interpreted | 417305 |
| TS safe | 4319802 |
| TS unsafe | 27269601 |
| TS unchecked | 33987147 |
| Zod | 1282523 |
| Valibot | 1204020 |
| Ajv | 4262427 |
Invalid object · fast-fail
Operations per second · warmed median
| Validator | Operations per second |
|---|---|
| TS interpreted | 3095730 |
| TS safe | 42378094 |
| TS unsafe | 50016548 |
| TS unchecked | 50468276 |
| Zod | 82542 |
| Valibot | 928058 |
| Ajv | 29102274 |
Invalid object · diagnostics
Operations per second · warmed median
| Validator | Operations per second |
|---|---|
| TS interpreted | 35271 |
| TS safe | 1983296 |
| TS unsafe | 2830517 |
| TS unchecked | 3352127 |
| Zod | 76309 |
| Valibot | 895002 |
| Ajv | 29650288 |
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.
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