Install TypeScript
Install TypeScript globally
$npm install -g typescript
Install TypeScript as a dev dependency (recommended)
$npm install typescript --save-dev
Check TypeScript version
$tsc --version

Initialize tsconfig
Note: tsconfig.json controls how TypeScript compiles your project. Always generate it at the root of your project.
Generate default tsconfig.json
$tsc --init
Generate tsconfig with strict mode enabled
$tsc --init --strict

Compile & Run
Compile a TypeScript file to JavaScript
$tsc index.ts
Compile entire project using tsconfig.json
$tsc
Watch mode — auto-recompile on changes
$tsc --watch
Install ts-node to run TypeScript directly
$npm install -g ts-node
Run a TypeScript file directly (no compile step)
$ts-node index.ts
Type-check without emitting output files
$tsc --noEmit