Start using TypeScript
Install TypeScript in a project
Add the compiler as a development dependency and run the project-local version so every contributor uses the same toolchain.
Create a project folder with a package.json, then install TypeScript locally:
npm init -y
npm install --save-dev typescript
Check the project-local compiler:
npx tsc --version
npx finds the tsc executable from the project dependency. This keeps the expected compiler version in package.json instead of relying on an unrelated global installation.
That matters because compiler versions can add checks and understand new syntax. Two contributors should not get different results because their global tools differ.
The --save-dev flag records TypeScript as a development dependency. Your application does not need the compiler after you have produced runnable JavaScript, unless your deployment process compiles there.
If npx tsc cannot run, inspect package.json and confirm that installation completed. Do not fix a local-project problem by installing a random global version.
Exercise: run npx tsc --version, then find the recorded TypeScript range in package.json.
Lesson completed