TypeScript is JavaScript with types. You write .ts files, the compiler checks them and emits plain .js. Here's how to set up the full loop in VS Code.

Install Node.js and TypeScript

TypeScript runs on Node, so install Node.js first (nodejs.org). Then install the compiler:

npm install --save-dev typescript
npx tsc --init

tsc --init creates a tsconfig.json that controls how your code compiles.

VS Code

VS Code has first-class TypeScript support built in — you get type errors and IntelliSense as you type, no extension required. Add ESLint and Prettier if you like.

Write, compile and run

Create main.ts:

type User = { id: number; name: string };

function label(user: User): string {
  return `${user.id}: ${user.name}`;
}

console.log(label({ id: 1, name: "Ada" }));

Compile then run the emitted JavaScript:

npx tsc
node main.js

For a fast edit-run loop, npx tsx main.ts runs TypeScript directly without a separate compile step.

Debug it

Set "sourceMap": true in tsconfig.json so breakpoints map back to your .ts files. Set a breakpoint, press F5 → Node.js, and you'll debug the original TypeScript, not the compiled output.

Build

npx tsc is your build — it type-checks the whole project and emits JavaScript into the outDir you configured. Run tsc --noEmit in CI to fail the build on type errors without producing files.