Skip to Content
📖 Guide Documents🙋🏻‍♂️ Introduction

banner of ttsc

MIT LicenseNPM VersionNPM DownloadsBuild StatusGuide DocumentsDiscord

A typescript-go toolchain for compiler-powered plugins and type-safe execution.

  • ttsc: build, check, and transform.
  • ttsx: execute TypeScript with type checking.
  • @ttsc/lint: lint violations as compiler errors.
  • @ttsc/graph: MCP code graph that reduce token usage.
  • plugin support: compiler-powered libraries, such as typia.

Setup

Install

Install ttsc, @ttsc/lint, and the native TypeScript compiler:

npm install -D ttsc @ttsc/lint typescript@rc

Commands

Run TypeScript directly with ttsx (CLI command):

npx ttsx src/index.ts

Build, check, or watch the project with ttsc:

npx ttsc npx ttsc --noEmit npx ttsc --watch

Rewrite source files in place with the @ttsc/lint format rules:

npx ttsc format

Editor

Install the VS Code extension to show TypeScript errors and supported ttsc plugin diagnostics in the editor. Search ttsc in the Marketplace, or run:

npx @ttsc/vscode

See @ttsc/vscode for requirements and settings.

Bundlers

Use @ttsc/unplugin when a bundler owns your build.

It runs ttsc plugins inside supported bundlers.

npm install -D ttsc @ttsc/lint typescript@rc npm install -D @ttsc/unplugin

Minimal 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.

Coding Agents (MCP)

@ttsc/graph is an MCP server that gives a coding agent a map of your codebase.

It answers “what relates to this symbol” or “what does this change affect” straight from the type checker, so the agent stops grepping and re-reading files.

It also carries the project’s full diagnostics: type errors, @ttsc/lint violations, and plugin findings. They are fused onto the graph, so an agent sees a change’s reach over what is already broken before editing.

npm install -D ttsc @ttsc/graph typescript@rc

Point your agent’s MCP client at it. For Claude Code:

{ "mcpServers": { "ttsc-graph": { "command": "npx", "args": ["-y", "@ttsc/graph"] } } }

On codegraph’s own benchmark, Claude agents answer reading zero files, cutting tokens by 77% to 86% and tool calls by 94% to 95%.

See @ttsc/graph and the benchmark.

Plugins

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

Transform Example

A 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 typia from "typia"; import * as __typia_transform__isFormatEmail from "typia/lib/internal/_isFormatEmail"; import * as __typia_transform__isFormatUuid from "typia/lib/internal/_isFormatUuid"; import * as __typia_transform__isTypeUint32 from "typia/lib/internal/_isTypeUint32"; 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); // true

List of Plugins

ttsc ships a few small utility plugins in this repository.

  • @ttsc/banner: adds @packageDocumentation JSDoc banners.
  • @ttsc/lint: lints and formats TypeScript source.
  • @ttsc/graph: MCP server exposing a checker-resolved code graph and diagnostics to coding agents.
  • @ttsc/paths: rewrites source path aliases so JS and declaration emit receive relative imports.
  • @ttsc/strip: removes configured calls and debugger statements.
  • @ttsc/unplugin: runs ttsc plugins inside bundlers supported by unplugin.

Plugin authors should start from the Guide Documents.

Ecosystem plugins are listed below; PRs adding ttsc plugins are welcome.

  • nestia: generates NestJS routes, OpenAPI, and SDKs.
  • typia: generates validators, serializers, and type-driven runtime code.

Sponsors

Sponsors

Thanks for your support.

Your donation encourages ttsc development.

References

Last updated on