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:
- Install the package:
npm install -D @ttsc/banner - Register it in
tsconfig.json:{ "compilerOptions": { "plugins": [ { "transform": "@ttsc/banner" } ] } } - (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
| Plugin | What it adds | Page |
|---|---|---|
@ttsc/banner | JSDoc @packageDocumentation banner on every emit. | @ttsc/banner |
@ttsc/paths | Rewrites compilerOptions.paths aliases into relative imports in the emit. | @ttsc/paths |
@ttsc/strip | Strips 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.