ternTS · Comparison

ternTS vs swc, esbuild, tsc and tsgo.

Every TypeScript project ends up choosing a transpiler. Here’s how they differ on what matters day to day: speed, decorator metadata, type checking, and whether you get the JavaScript tsc would have written.

At a glance

ternTSswcesbuildtsgotsc
NestJS, 1,959 files, one thread32 ms202 msnot measured624 ms1,440 ms
VS Code, 13,454 files, one thread1.33 s6.07 snot measured22.2 s40.2 s
Type checkingnononoyesyes
Decorator metadata (emitDecoratorMetadata)yesyesnoyesyes
Output identical to tsc’syes, checked on 37,319 filesno: its own helpers and outputnoclose, not checked—
Lowest targetES2015ES5ES2015 (ES5 only in part)ES2015ES5
Bundlingnonoyesnono
Written inTernRustGoGoTypeScript

Timings: transpiling in-process on an Apple M4 Pro with Node 24, swc 1.16.12, TypeScript 5.9.3 and tsgo 7.0.2; node bench/run.mjs in the ternTS repository reproduces them. esbuild isn’t in that benchmark. Its lack of metadata support is in esbuild’s own TypeScript caveats.

Which one to use

You need type errors: tsc or tsgo

Only tsc and tsgo (the Go port that becomes TypeScript 7) check types. Everyone else, ternTS included, assumes you run one of them as well, in CI or your editor, usually as tsc --noEmit. A common setup is a fast transpiler for builds, dev servers and tests, plus a type check that runs on its own.

You use decorators with metadata: ternTS

NestJS, TypeORM, Angular, type-graphql and InversifyJS read the types that emitDecoratorMetadata writes. esbuild doesn’t emit them, so those apps break under it. swc emits them with its own helpers, and its output isn’t tsc’s. ternTS writes what tsc writes, checked file by file against TypeScript 5.9: the whole NestJS repository, all of Nest’s 3,631 unit tests, and nine Nest apps that answer the same requests byte for byte, Swagger and GraphQL schemas included. See the NestJS guide.

You’re replacing ts-jest or @swc/jest: ternTS

On Nest’s repository the ternTS Jest transform takes 267 ms, against 392 ms for @swc/jest and 2,390 ms for ts-jest, with one line of config to switch. See the Jest guide.

You need ES5 output: swc or tsc

ternTS lowers every target from ES2015 up exactly as tsc does. If you still ship to browsers without ES2015, use swc or tsc.

You’re bundling a frontend: esbuild (or Vite)

esbuild is a bundler first. If you don’t need decorator metadata, it’s a fine way to strip types while you bundle. If you do, the ternTS Vite plugin (@ternlang/ternts/vite) compiles TypeScript the way tsc does before Vite bundles it.

Why ternTS is faster

ternTS has no syntax tree for most of a file. Its parser walks the tokens and copies your source straight through, editing only the parts TypeScript adds: types, decorators, enums, parameter properties. Most TypeScript is already JavaScript, so most bytes are copied, never rebuilt. It’s written in Tern, a compiled language, and the whole transpiler is about 10,000 lines. It runs as a native binary, or as 1 MB of WebAssembly in the playground.