Practical uses
- Build large web applications with safer refactoring
- Create typed APIs and backend services
- Publish reliable JavaScript libraries
- Share domain models across frontend and backend
JavaScript with types, for catching mistakes before your code runs.
TypeScript is JavaScript with optional static types, checked by a compiler before the code runs. Your editor can catch mistakes and suggest completions as you type, and because all valid JavaScript is valid TypeScript, you can adopt it one file at a time.
Install TypeScript with npm (you need Node.js first). For quick experiments, ts-node or tsx can run .ts files directly without a separate compile step. You do not need this to follow the lessons: the examples run in your browser.
# Install Node.js from nodejs.org first
# Then install TypeScript and ts-node:
npm install -g typescript ts-node
# Verify:
tsc --version
ts-node --versionLearn the basics first, then pick up these tools when a project needs them.