Install TypeScript
Node first
TypeScript runs on Node, so install Node before anything else. Any recent long term support release works well for this course. Confirm the install with two version checks:
node --version
v20.11.0
npm --version
10.2.4
Both commands print a version number when the setup is correct. When the terminal reports that the command was not found, reinstall Node and open a fresh terminal window.
npm i -g typescript
Install the compiler with one npm command. The g flag installs a single copy for the whole machine, so every folder can reach tsc without a local install:
npm i -g typescript
added 1 package in 2s
The download takes under a minute on a normal connection. When npm finishes, the tsc command becomes available in every new terminal.
tsc --version
Check that the compiler answers. The exact number on your machine may be newer than the one below, and any recent version is fine for this course:
tsc --version
Version 5.4.5
A version line means the install worked. When the terminal still cannot find tsc, close the terminal completely and open it again so the new search paths take effect.
tsc --init
Move into your project folder and generate a starter config. This file stores compiler options so you never type long flag lists by hand:
tsc --init
Created a new tsconfig.json
The command creates tsconfig.json in the current folder. The next lesson uses it to compile your first program.
Next: Your first program
Article author: Arthur Isaev