A typescript-go toolchain for compiler-powered plugins and type-safe execution.
ttsc: build, check, and transform.ttsx: execute TypeScript with type checking.- native TypeScript-Go execution instead of transpile-only runners.
- type checking that
tsxdoes not provide.
- plugin support: compiler-powered libraries, such as
typia.@ttsc/lint: lint violations as TS compile errors.
Install the native TypeScript preview package with ttsc:
npm install -D ttsc @typescript/native-previewRun TypeScript directly with ttsx (CLI command):
npx ttsx src/index.tsBuild, check, or watch the project with ttsc:
npx ttsc
npx ttsc --noEmit
npx ttsc --watchUse @ttsc/unplugin when a bundler owns your build.
It runs ttsc plugins inside supported bundlers.
npm install -D ttsc @typescript/native-preview
npm install -D @ttsc/unpluginMinimal Vite setup:
// vite.config.ts
import ttsc from "@ttsc/unplugin/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [ttsc()],
});Supported bundlers:
- Vite
- Rollup
- Rolldown
- esbuild
- Webpack
- Rspack
- Next.js
- Farm
- Bun
See @ttsc/unplugin for full setup and adapter options.
Plugins let libraries add compile-time checks, transforms, and type-driven code generation to normal ttsc and ttsx runs.
# compile
npx ttsc
# execute
npx ttsx src/index.tsA transform uses TypeScript types to generate JavaScript before runtime.
import typia, { tags } from "typia";
import { v4 } from "uuid";
const matched: boolean = typia.is<IMember>({
id: v4(),
email: "samchon.github@gmail.com",
age: 30,
});
console.log(matched); // true
interface IMember {
id: string & tags.Format<"uuid">;
email: string & tags.Format<"email">;
age: number &
tags.Type<"uint32"> &
tags.ExclusiveMinimum<19> &
tags.Maximum<100>;
}The transform replaces typia.is<IMember>() with dedicated JavaScript checks at build time:
import * as __typia_transform__isFormatUuid from "typia/lib/internal/_isFormatUuid";
import * as __typia_transform__isFormatEmail from "typia/lib/internal/_isFormatEmail";
import * as __typia_transform__isTypeUint32 from "typia/lib/internal/_isTypeUint32";
import typia from "typia";
import { v4 } from "uuid";
const matched = (() => {
const _io0 = (input) =>
"string" === typeof input.id &&
__typia_transform__isFormatUuid._isFormatUuid(input.id) &&
"string" === typeof input.email &&
__typia_transform__isFormatEmail._isFormatEmail(input.email) &&
"number" === typeof input.age &&
__typia_transform__isTypeUint32._isTypeUint32(input.age) &&
19 < input.age &&
input.age <= 100;
return (input) => "object" === typeof input && null !== input && _io0(input);
})()({
id: v4(),
email: "samchon.github@gmail.com",
age: 30,
});
console.log(matched); // truettsc ships a few small utility plugins in this repository.
@ttsc/banner: adds@packageDocumentationJSDoc banners.@ttsc/lint: reports lint violations as TypeScript compile errors.@ttsc/paths: rewrites source path aliases so JS and declaration emit receive relative imports.@ttsc/strip: removes configured calls anddebuggerstatements.@ttsc/unplugin: runsttscplugins inside bundlers supported byunplugin.
Plugin authors should start from the Guide Documents.
Ecosystem plugins are listed below; PRs adding ttsc plugins are welcome.
