Skip to Content

Plugins

ttsc plugins are npm packages that hook into the compiler. Once installed, every ttsc build, ttsx run, and ttscserver session sees them. You don’t import anything in your code β€” the plugin runs on the compiler pipeline.

This chapter covers the first-party plugins. For lint and format, see the separate @ttsc/lint chapter.

The basic shape

Every plugin install is three steps:

  1. Install the package:
    npm install -D @ttsc/banner
  2. Register it in tsconfig.json:
    { "compilerOptions": { "plugins": [ { "transform": "@ttsc/banner" } ] } }
  3. (Some plugins) Add a config file β€” e.g. banner.config.ts. Each plugin’s page tells you which it needs.

That’s the whole pattern.

First-party plugins

PluginWhat it addsPage
@ttsc/bannerJSDoc @packageDocumentation banner on every emit.@ttsc/banner
@ttsc/pathsRewrites compilerOptions.paths aliases into relative imports in the emit.@ttsc/paths
@ttsc/stripStrips console.log, debugger, configured calls from emit.@ttsc/strip

Lint and format are also plugins, but they’re big enough to have their own chapter: @ttsc/lint.

Ecosystem plugins

Outside the ttsc repo, following the same protocol:

  • typia β€” Runtime validators, JSON tools, LLM tooling generated from your TypeScript types.
  • nestia β€” NestJS controllers, OpenAPI documents, SDK generation, E2E test scaffolding.

PRs adding plugins to this list are welcome. The bar is β€œinstalls and works on a current ttsc release.”

A common starter config

Most projects end up with something like this:

// tsconfig.json { "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, "outDir": "dist", "rootDir": "src", "plugins": [ { "transform": "@ttsc/lint" }, { "transform": "@ttsc/paths" } ] }, "include": ["src"] }

Add @ttsc/banner when you ship to npm. Add @ttsc/strip for the production build. Add typia when you want runtime validators.

How discovery works

ttsc reads compilerOptions.plugins. For each entry, the transform field is treated as an npm import path. The first time the plugin is used, ttsc compiles its Go transform into a binary cached at node_modules/.ttsc/. Subsequent runs reuse the cache. Pre-warm with ttsc prepare.

Configuration: file vs inline

Two plugins (@ttsc/lint, @ttsc/banner) prefer a sibling config file because the configuration itself is typed TypeScript. Other plugins accept their options inline in the compilerOptions.plugins entry. Each plugin page documents the exact contract.

When in doubt, use the config-file form β€” your editor will type-check it.

Writing your own

That’s the Plugin Development chapter.

Last updated on