You compile TypeScript with tsc, the TypeScript compiler. It type-checks your .ts files and emits plain .js files that run in any JavaScript environment.
# Install TypeScript globally
npm install -g typescript
# Compile a single file
tsc app.ts
# Compile with watch mode
tsc app.ts --watch
# Compile using tsconfig.json
tsc
Running tsc with no file names finds the nearest tsconfig.json and compiles the whole project with its settings. Naming a file, as in tsc app.ts, compiles just that file with default options. Since TypeScript 6.0 that is an error when a tsconfig.json is present, unless you add --ignoreConfig. Adding --watch recompiles whenever a file changes.
In many projects tsc only type-checks. A bundler such as Vite strips the types and builds the output, and tsc --noEmit runs separately as the type check. Node.js can also run a .ts file directly by stripping its types, but it does no type checking at all.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓