Skip to Content

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.

PathWhen to usePackageDefault?
TypeScript-Go (ttsc)TypeScript-Go preview (@typescript/native-preview) โ€” experimentaltypia@nextexperimental 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.

Terminal
# install npm i typia@next npm i -D ttsc @typescript/native-preview # build npx ttsc # run without building first npx ttsx src/index.ts
Important

You 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.config.ts
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.

Terminal
# 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.ts

npx 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.config.ts
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:

src/check-setup.ts
import typia from "typia"; console.log(typia.is<{ id: string }>({ id: "ok" })); // โ†’ true

If 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

Last updated on