Installing TypeScript
Install Node.js first
TypeScript ships as an npm package. Install a current Node.js LTS release so you have node and npm available.
node --version
npm --version
Install the compiler
Install TypeScript globally for quick experiments, or as a project dependency for real work.
npm install -g typescript
# Or in a project folder:
npm init -y
npm install --save-dev typescript
Check tsc
The compiler should print a version number.
tsc --version
Know what tsc does
tscchecks types and emits JavaScript- Browsers and Node run the emitted
.js, not the.tssource - Editors use the same type checker for inline errors
- You can run TypeScript with
npx tsxorts-nodefor learning, buttscis the standard compile step
Comments
One comment per signed-in account. Comments are saved with this page’s URL.