Pick your setup path
typia is a compile-time transformer, so it has to plug into your TypeScript build. There are two supported paths โ pick the one that matches your TypeScript version.
| Path | When to use | Package | Default? |
|---|---|---|---|
TypeScript-Go (ttsc) | TypeScript-Go preview (@typescript/native-preview) โ experimental | typia@next | experimental preview |
Legacy (ts-patch) | Stable TypeScript v5 or v6 (the standard typescript npm package) | typia | โ recommended |
TypeScript-Go is the in-progress Go-rewrite of the TypeScript compiler shipped by the TypeScript team. The transformer plug-in API is settled, but packaging and binary naming are not โ pin versions carefully and expect breakage.
Legacy is what every typia user is running in production today. It patches the JavaScript-based tsc at install time via ts-patch; from then on every tsc build applies the typia transform. No experimental preview required.
If you donโt know which to pick, choose Legacy.
TypeScript-Go
Use typia@next. TypeScript is migrating its compiler from JavaScript to Go (the โTypeScript-Goโ project). ttsc is the Go-native plugin toolchain for that compiler, and typia@next ships a Go-rewritten transform that plugs into it.
npm
# install
npm i typia@next
npm i -D ttsc @typescript/native-preview
# build
npx ttsc
# run without building first
npx ttsx src/index.tsYou must use ttsc and ttsx. The stock tsc, ts-node, and tsx cannot apply the typia transform, so they will silently produce a build with no validators.
For bundlers, use @ttsc/unplugin:
Vite
import ttsc from "@ttsc/unplugin/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [ttsc()],
});Continue to TypeScript-Go setup for the full configuration reference.
Legacy
Use typia. The legacy path uses ts-patch on top of the JavaScript-based TypeScript compiler. This is the stable release path used in production today.
npm
# install
npm i typia
npm i -D typescript ts-node ts-patch
npx typia setup
# build
npx tsc
# run without building first
npx ts-node src/index.tsnpx typia setup runs a one-shot wizard that installs the right ts-patch plugin entry into your tsconfig.json and wires up a prepare script.
For bundlers, use @typia/unplugin:
Vite
import UnpluginTypia from "@typia/unplugin/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [UnpluginTypia()],
});Continue to Legacy setup for tsconfig.json details, NX, Webpack notes, and the generation fallback for projects that canโt run a transformer (Babel, SWC).
Verify the setup
Drop this into your project and run it:
import typia from "typia";
console.log(typia.is<{ id: string }>({ id: "ok" }));
// โ trueIf you see true, the transformer ran. If you see an error like typia transformer has not been configured, the build is using stock tsc / tsx instead of ttsc / ttsx or ts-patch. Re-check the build command and tsconfig.json plugin entry.
Where to go next
- Full ttsc setup including bundler plugins โ TypeScript-Go setup
- Full ts-patch setup, NX, Webpack, generation-mode fallback โ Legacy setup
- First validator after setup โ
isยทassertยทvalidate - Why typia needs a transform at all โ Pure TypeScript