Skip to content
Rust + oxc static checker · Zero runtime overheadDocs by Gemini 4 Neon Extra

TypeScript with Rust's rules.
Built for AI-written code. ​

Every failure lives in the return type. null doesn't exist. State is never mutated behind your back. SAFE-TS checks your whole program in milliseconds—turning the silent bugs coding agents ship into compiler errors with actionable fixes.

170Static rules across TS, Vue & React
< 1 secWhole-program Rust + oxc check
0 BChecker runtime · compiles to plain JS
~25 bugsCaught on real production repos

Live WebAssembly Checker

Try the checker in your browser ​

Loading checker…

Loading the Rust checker (WebAssembly, ~700 kB)…

This is the real Rust checker compiled to WebAssembly. It inspects a single file—imports don't resolve here, so cross-module failure tracking runs through the CLI, CI, or editor LSP.

Why Strictness Works Now

Strictness used to tire humans. For an agent, ceremony is free. ​

Coding agents write faster than anyone can review, and they reproduce every silent TypeScript trap: swallowed errors, null mixed with undefined, unchecked casts, unvalidated JSON, shared mutable state, and async races. Every one of them looks fine in a diff. On real work projects, SAFE-TS caught around 25 real bugs in each.

What makes strict code tiring for a person costs an agent nothing. Twenty explicit lines instead of three, a Result on every failing call, a reason on every escape hatch: an agent never gets tired of that. What it needs is a fast, precise compiler signal—and because an agent aims at "the checker passes", SAFE-TS puts its effort into deep whole-program static analysis with every escape hatch counted.

AI Agent Migration SkillCensus + Architecture Gates
$ npx @evobug_com/safe-ts-skill
1
Agent writes plain TypeScript
No new language dialect—ordinary TS that tsc --strict still type-checks.
2
Whole-program pass in milliseconds
Follows throws, mutable loans, and sinks across files, frameworks, and node_modules.
3
Actionable fix in every diagnostic
Says what failed, why, and which std helper or pattern replaces it.
4
Counted escape hatches in CI
--baseline locks unsafe() and ignore counts so technical debt only trends down.

Core Philosophy

Four rules that eliminate whole bug classes ​

01Result<T, E> · q()

Failures are visible ​

A function that can fail declares it in its return type (Result<T, E>), or throws a tracked PropagateError that something upstream is proven to catch.

02Option<T>

One way to be missing ​

Absence is always T | undefined (Option<T>). null is banned so every ?., ??, and optional check speaks a single language.

03Mut<T> · mut(x)

Explicit ownership & mutation ​

No mutable module globals. Parameters are read-only unless typed Mut<T> and explicitly lent at the call site with mut(value)—like Rust's &mut.

04parseJson<T>()

Checked at every boundary ​

External JSON, files, and network payloads are validated against your TypeScript types using build-time generated validators and proof brands.

Side-by-Side · Every Example Is a Test

Before and after ​

Each pair below runs in cargo test and tsc --strict. Rejected code must trigger the exact rules shown; accepted code produces zero diagnostics. Where the build transform rewrites accepted code, switch to the Compiled tab to inspect the emitted JavaScript.

throw hides the failure from the function signature, so callers only discover it in production.

✕ Rejectedno-throw
ts
export function parsePort(text: string): number {
  const port = Number(text);
  if (!Number.isInteger(port)) throw new Error(`not a port: ${text}`);
  return port;
}

Named PortError variants live in the return type. q(...) propagates errors like Rust's ? and compiles to a plain early return.

✓ Accepted0 diagnostics
ts
import { constructors, type Enum } from "@evobug_com/safe-ts-std/enum";
import { err, q, type Result } from "@evobug_com/safe-ts-std/result";

export type PortError = Enum<{ NotANumber: { text: string }; OutOfRange: { port: number } }>;
const PortError = constructors<PortError>();

function parsePort(text: string): Result<number, PortError> {
  const port = Number(text);
  if (!Number.isInteger(port)) return err(PortError.NotANumber({ text }));
  if (port < 1 || port > 65535) return err(PortError.OutOfRange({ port }));
  return port;
}

export function address(host: string, port: string): Result<string, PortError> {
  const checked = q(parsePort(port));
  return `${host}:${checked}`;
}
ts
import { constructors, type Enum } from "@evobug_com/safe-ts-std/enum";
import { Err as __qErr } from "@evobug_com/safe-ts-std/result"; import { err, q, type Result } from "@evobug_com/safe-ts-std/result";

export type PortError = Enum<{ NotANumber: { text: string }; OutOfRange: { port: number } }>;
const PortError = constructors<PortError>();

function parsePort(text: string): Result<number, PortError> {
  const port = Number(text);
  if (!Number.isInteger(port)) return err(({ tag: "NotANumber", text } satisfies PortError as PortError));
  if (port < 1 || port > 65535) return err(({ tag: "OutOfRange", port } satisfies PortError as PortError));
  return port;
}

export function address(host: string, port: string): Result<string, PortError> {
  const __q1 = parsePort(port); if (__q1 instanceof __qErr) return __q1; const checked = __q1;
  return `${host}:${checked}`;
}

More in the errors guide.

Zero-Friction Integration

Runs everywhere your code lives ​

Editor & LSP ​

safe-ts lsp reports cross-file diagnostics as you type in .ts, .tsx, and .vue, lists every possible failure on hover, and applies one-click quick fixes. Works alongside the oxlint plugin (Editor).

Zero-Cost Build Transforms ​

The Vite plugin, Node loader, and Bun preload rewrite q(...), match(...), parseJson<T>(...), and array chains into plain fast JavaScript. Run safe-ts explain to inspect every rewrite.

Whole-Program CI & Libraries ​

safe-ts check src/main.ts traces failures across monorepo entries and inspects node_modules automatically, backed by feature packs for Node, DOM, Zod, ws, and vue-router (Libraries).

Get Started in 60 Seconds

Install SAFE-TS ​

Packages are published on npm under @evobug_com with prebuilt native binaries for Linux (x64, arm64), macOS (x64, arm64), and Windows (x64).

sh
npm install -D @evobug_com/safe-ts-transform @evobug_com/oxlint-plugin-safe-ts oxlint
npm install @evobug_com/safe-ts-std
jsonc
{ "extends": ["./node_modules/@evobug_com/oxlint-plugin-safe-ts/recommended.json"] }
ts
import { safeTs } from "@evobug_com/safe-ts-transform";
import { defineConfig } from "vite";

export default defineConfig({ plugins: [safeTs()] });
sh
node --import @evobug_com/safe-ts-transform/register main.ts
toml
preload = ["@evobug_com/safe-ts-transform/bun"]

[test]
preload = ["@evobug_com/safe-ts-transform/bun"]
sh
npx @evobug_com/safe-ts-skill
sh
git clone https://git.evobug.com/Evobug/Safe-Ts.git
cd Safe-Ts
npm install
npm run build   # the Rust checker and its Node addon
npm run check   # check the demo app, which has problems on purpose

Rolling SAFE-TS out onto an existing codebase? Adopting SAFE-TS covers incremental migration with // @safe-ts legacy and escape-hatch baselines, or hand the migration skill straight to your coding agent.

SAFE-TS is opinionated by design: some patterns that take three lines elsewhere take twenty here. Read the overview for what it guarantees—and exactly where its static boundaries lie.

MIT OR Apache-2.0 · Docs by Gemini 4 Neon Extra