Course contentsShow
← TypeScript
Lesson 71 of 1,7962. Setup and ToolingFree lesson

Running TypeScript in Bun

Bun also runs TypeScript natively, with built-in transpilation and fast startup times.

Running TypeScript in Bun

You'll learn: How Bun provides built-in, zero-configuration TypeScript execution with exceptionally fast performance.

What is Bun's TypeScript Support?

Bun is a modern JavaScript runtime (like Deno, which you just learned about) that runs TypeScript files directly without requiring separate compilation or third-party tools. When you execute a .ts file with Bun, it automatically transpiles the TypeScript to JavaScript internally before running it—all in a single, lightning-fast step.

Think of Bun like a multilingual interpreter who instantly translates a foreign language document as they read it aloud. You hand them TypeScript, and they seamlessly speak JavaScript without you needing to pre-translate anything.

How It Works

Unlike Node.js (where you needed ts-node, tsx, or manual tsc compilation), Bun has TypeScript support baked directly into its core. This means:

  • No installation needed: No ts-node, no tsx, no extra packages
  • No configuration required: Works with any TypeScript file immediately
  • Blazing fast startup: Bun's transpiler is written in highly optimized code (Zig language), making it significantly faster than alternatives
  • Native tsconfig.json support: Respects your existing TypeScript configuration
# Just run your TypeScript file directly
bun run app.ts

# Or even simpler
bun app.ts

That's it. No build step, no watching, no intermediate compilation—just instant execution.

When to Use Bun

Bun excels when you want the absolute fastest development experience and are building modern applications. It's particularly attractive for new projects where you control the runtime environment.

Key Takeaway: Bun runs TypeScript natively with zero setup and exceptional speed, making it the most frictionless option for executing TypeScript code directly.