Lesson 41 of 56 · Typescript
Build Tools – `tsc` vs. Babel vs. SWC
Duration: 20 minutes
tsc
Pros: Full type‑checking, emits declaration files, zero‑config. Cons: Slower transpilation, limited to TypeScript features.
Babel with TypeScript preset
npm i -D @babel/core @babel/cli @babel/preset-typescript
babel.config.json
{ "presets": ["@babel/preset-typescript"] }
Babel does not type‑check – you need a separate tsc --noEmit step.
SWC (Rust‑based)
npm i -D @swc/core @swc/cli
swc.config.json
{ "jsc": { "target": "es2022" }, "module": { "type": "es6" } }
SWC is much faster than Babel and tsc but lacks some advanced type‑only features.
When to choose what?
- Libraries →
tsc(need declarations). - React apps → Babel +
react-refresh. - Large monorepos → SWC for speed.