ttsc

raw JSON →
0.6.0 verified Fri May 01 auth: no javascript

ttsc is a general-purpose TypeScript-to-Go compiler, plugin host, and runtime that enables compiler-powered transforms and type-safe execution. Current stable version is v0.6.0, released with ongoing updates roughly every few months. Key differentiators: it provides a ttsx executor that is 10x faster than ts-node and includes type checking (unlike tsx), supports native Go-based transformer plugins configured via tsconfig.json, and integrates with libraries like typia. It includes a built-in linter and supports TypeScript 6 preview.

error Cannot find module '@typescript/native-preview'
cause Missing required dependency after updating to ttsc v0.6.0.
fix
Install with 'npm i -D @typescript/native-preview'.
error Error: TypeScript compiler host not found. Is TypeScript installed?
cause TypeScript is not installed or the wrong version is used (ttsc requires TypeScript 5.x or later).
fix
Install TypeScript: 'npm i -D typescript'.
error error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'
cause Incorrect plugin transform path in tsconfig.json, causing type mismatch.
fix
Check that 'transform' property points to a valid plugin module (e.g., 'typia/lib/transform').
breaking ttsc v0.6.0 requires @typescript/native-preview to be installed as a devDependency. Without it, ttsc fails with 'Cannot find module @typescript/native-preview'.
fix Run 'npm i -D @typescript/native-preview' alongside ttsc.
gotcha Plugin transformations run in Go binaries; cache can become stale when developing plugins. Clear cache with 'npx ttsc clean' to avoid unpredictable behavior.
fix Run 'npx ttsc clean' after modifying plugin code.
deprecated The 'ttsc lint' command was experimental in v0.5.0 and may be removed in future versions. Use dedicated linters like ESLint instead.
fix Avoid reliance on built-in linting; configure ESLint independently.
gotcha Plugin configuration in tsconfig.json uses 'transform' key (not 'transformer'), which can cause silent failures if misnamed.
fix Ensure plugin objects have a 'transform' property pointing to the module import path.
breaking ttsc v0.4.0 changed the binary name from 'tsgo' to 'ttsc'. Scripts referencing 'tsgo' will break.
fix Replace 'tsgo' with 'ttsc' in package.json scripts and shell commands.
gotcha ttsx does not support all TypeScript config features like tsconfig paths without the @ttsc/paths plugin. May cause module resolution failures.
fix Install and configure @ttsc/paths plugin in tsconfig.json.
npm install ttsc
yarn add ttsc
pnpm add ttsc

Shows installation and basic usage of ttsc/ttsx with typia for type validation, including CLI commands for execution and compilation.

// 1. Install dependencies
// npm i -D ttsc @typescript/native-preview

// 2. Create a TypeScript file src/index.ts:
import typia, { tags } from 'typia';

const result = typia.is<{ name: string }>({ name: 'test' });
console.log(result); // true

// 3. Run with ttsx:
// npx ttsx src/index.ts

// 4. Or compile with ttsc:
// npx ttsc