TypeScript-Go (ttsc)
This setup targets TypeScript-Go — the Go rewrite of the TypeScript compiler that ships under @typescript/native-preview. typia@next ships a Go-rewritten transform that plugs into it through the ttsc toolchain.
You need three commands:
ttsc— build, check, and watch a TypeScript projectttsx— execute a TypeScript file directly, with type checking@ttsc/unplugin— connectttscto a bundler (Vite, Next.js, Webpack, …)
@typescript/native-preview is not yet a stable TypeScript release, and typia@next is the matching experimental release of typia. For production today, use the Legacy (TS v6) setup.
The stock tsc, ts-node, and tsx cannot apply the typia transform — you must use ttsc and ttsx.
Install
npm
npm i typia@next
npm i -D ttsc @typescript/native-previewThen keep your TypeScript project strict:
{
"compilerOptions": {
"strict": true
}
}That’s it. Unlike the legacy setup, you do not add compilerOptions.plugins for typia — ttsc discovers the transform from the ttsc field in typia/package.json automatically.
Build
Use ttsc exactly the way you would use tsc:
npm
npx ttsc # build
npx ttsc --noEmit # type-check only
npx ttsc --watch # rebuild on changeExecute without building
Use ttsx instead of ts-node or tsx:
npm
npx ttsx src/index.tsBundlers
Bundlers (Vite, Next.js, Webpack, …) run their own TypeScript pipeline that bypasses ttsc. To plug typia in, install @ttsc/unplugin and add its plugin to your bundler config.
Install
npm
npm i -D @ttsc/unpluginConfigure
@ttsc/unplugin exposes one entry per bundler — import the matching path:
Vite
import ttsc from "@ttsc/unplugin/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [ttsc()],
});Drop the plugin into the same config file that already builds your app (vite.config.ts, next.config.mjs, webpack.config.mjs, …). After that, run your normal build command — no other change.
Pointing at a different tsconfig.json
If your bundler should use a config other than the default tsconfig.json, pass project:
Vite
import ttsc from "@ttsc/unplugin/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
ttsc({
project: "tsconfig.bundle.json",
}),
],
});The project path is resolved from the current working directory.
Tuning the transform
Most projects don’t need to touch this. Add compilerOptions.plugins only when you want to flip one of the optional transform flags:
{
"compilerOptions": {
"strict": true,
"strictNullChecks": true,
"plugins": [
{
"transform": "typia/lib/transform",
"functional": true, // default: false
"numeric": true, // default: false
"finite": true // default: false
}
]
}
}| Flag | Default | What it does |
|---|---|---|
functional | false | Validate function-typed properties as well as data properties |
numeric | false | Reject NaN when a property is typed as number |
finite | false | Reject NaN and ±Infinity when a property is typed as number |
With the default flags you do not need compilerOptions.plugins. ttsc will pick up the transform from typia/package.json on its own.
Where to go next
- Stable production alternative → Legacy setup
- First validator after setup →
is·assert·validate - Why typia needs a transform at all → Pure TypeScript