Under The Hood
frontend bun Bun 1.x (Native Transpiler)

Native Zig Transpiler: Running .ts and .jsx with Zero Build Step

Last updated
Prerequisites:
TypeScript compiler (`tsc`)
JSX transpilation
  • bun
  • typescript
  • jsx
  • transpiler
  • zig
  • developer-experience

Read at your depth

The practical view

Bun natively executes `.ts`, `.tsx`, `.js`, and `.jsx` files without any build step, loader, or compilation script. When you run `bun run index.ts`, Bun parses and strips TypeScript types on the fly in memory and sends the bytecode directly to JavaScriptCore. JSX is transformed into `React.createElement` or modern JSX runtime (`jsx-dev`) calls automatically.

The same idea in other frameworks

node equivalent
`ts-node` / `tsx` / `esbuild-register` wrappers for running TypeScript files.

Legacy vs modern

Node.js ts-node Overhead vs Native Bun TypeScript Execution

Node requires third-party transpilers with startup lag; Bun executes `.ts` and `.tsx` natively in milliseconds.

before → after
Node.js ts-node (Slow Startup)
npx ts-node app.ts // ❌ 1-2 second startup latency for type compilation
Bun Direct Execution
bun app.ts // ✅ NEW: Instant execution with zero dependencies

Interview gotchas

Context

This is a fundamental question regarding how fast TypeScript runtimes operate.

The mechanical answer

**No, Bun does not type-check your code at runtime.** Bun's transpiler is a pure type stripper: it removes type annotations and executes the remaining JavaScript code directly. If your code has a TypeScript type mismatch (e.g. assigning a number to a string type), Bun will still execute it without error. To enforce type safety, run `tsc --noEmit` in your CI/CD pipeline.

Trap

Never assume that code running under Bun is type-safe without running `tsc --noEmit` in your test/lint scripts.

Under The Hood — a multi-depth technical interview hub.

Third-party licenses Press ⌘ K to search.