Setup

Three Ways to Run TypeScript Today

Setup

TS Playground for instant experiments. `tsc` for full projects. Modern runtimes (Node 22+, Bun, Deno) run `.ts` directly.

3 min read Level 1/5 #typescript#setup#tsc
What you'll learn
  • Try TS without installing
  • Install `tsc` for a project
  • Run TS directly with a modern runtime

Three reasonable ways to run TypeScript today. Pick by need.

1. The Playground (Zero Install)

typescriptlang.org/play — opens an editor with a live TS compiler in your browser. Every example in this course runs there.

Best for: experiments, small examples, sharing snippets.

2. tsc — The Real Compiler

For a project on your machine:

npm init -y
npm install -D typescript
npx tsc --init     # generates tsconfig.json

Now create index.ts and compile:

echo "const greeting: string = 'hello';" > index.ts
npx tsc
# produces index.js

Or watch mode — recompile on save:

npx tsc --watch

Best for: real projects you’ll ship.

3. Run TS Directly

Modern runtimes execute .ts files without a separate build step:

# Node 22+
node --experimental-strip-types index.ts

# Bun (built-in TS support)
bun run index.ts

# Deno (TS is native)
deno run index.ts

# tsx (small wrapper around esbuild)
npx tsx index.ts

Best for: scripts, prototypes, when you just want to run the code.

The TS Files

.ts — regular TypeScript files. .tsx — TypeScript with JSX (for React). .d.ts — declaration files (types only, no values). .mts / .cts — explicit ESM / CommonJS in Node.

Editor Setup

VS Code, Cursor, Zed, JetBrains — all have first-class TS support out of the box. No extension needed for basic typing. Errors show in real time, with quick-fix suggestions and refactor commands.

Up Next

Why bother — the practical wins.

Why TypeScript →