Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
TypeScript Setup
Install TypeScript, then compile .ts files to .js with the compiler tsc. A tsconfig.json configures how your project is checked and built.
Install and initialize
bash
npm install -D typescript
npx tsc --init # creates tsconfig.json
npx tsc # compiles the project to .jstsc --init generates a tsconfig.json with sensible defaults; tsc reads it and compiles every file in the project.
Run a file quickly while learning
Compiling then running is fine for projects, but during learning it's handy to run a .ts file directly with tsx (no separate compile step):
bash
npx tsx app.ts # type-aware, runs immediatelyWatch mode
tsc --watch recompiles automatically on every save β useful during active development for instant feedback.
bash
npx tsc --watchIn real projects
Note: In frameworks (React, Angular, NestJS, Next.js) the build tool (Vite, webpack, esbuild, or the framework CLI) handles TypeScript for you β you rarely call
tsc directly. You still keep a tsconfig.json to configure the type checker.Tip: For learning,
npx tsx file.ts is the fastest loop. For projects, let your framework's tooling compile TypeScript and use tsc --noEmit in CI purely as a type-check gate β catching type errors without producing output files.Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified