ts-node vs SWC: Running TypeScript Faster in CI
ts-node runs TypeScript through tsc; pairing it with the SWC register (or @swc-node) swaps in Rust-speed transpiling for much faster execution.
ts-node executes TypeScript via the TypeScript compiler. The SWC approach (ts-node's --swc flag or @swc-node/register) transpiles with SWC in Rust for far faster startup, at the cost of not running full type-checking during execution.
| ts-node | SWC (register) | |
|---|---|---|
| Transpile engine | tsc | SWC (Rust) |
| Startup speed | Slower | Much faster |
| Type checking | Optional (slower) | No (strip only) |
| ESM support | Works (config) | Works |
| Best for | Type-aware execution | Fast script/test execution |
In CI
Plain ts-node can type-check as it runs but is the slowest option; using the SWC register (or ts-node --swc) keeps the same workflow while transpiling far faster, which trims script and test startup. As with other fast transpilers, SWC does not type-check, so run tsc --noEmit separately. For sheer execution speed in CI, the SWC path wins.
Type-check separately
Add a tsc --noEmit step (in parallel) for type safety since SWC only strips types. Both run on CI runners; faster managed runners shorten long type-check passes on large codebases.
The verdict
Want the fastest TypeScript execution: ts-node with the SWC register (or @swc-node), plus a separate tsc --noEmit check. Need type-aware execution in one tool: plain ts-node. Most pipelines split speed from type-checking.