TypeScript Installation & TypeScript VSCode Setup

To install TypeScript, install Node.js, then run npm install -g typescript for a global install or npm install --save-dev typescript inside a project. Check it with tsc --version, create a config with tsc --init, and open the project in VS Code. The current release is TypeScript 7.0.

TypeScript is a popular programming language used for developing large-scale JavaScript applications. It adds additional features such as optional static typing, classes, and interfaces to JavaScript. In this blog post, we will discuss the steps required to install TypeScript onto your machine.

Short version

Terminalbash
npm install -g typescript          # global install
npm install --save-dev typescript  # or: per project (run with npx tsc)
tsc --version
tsc --init                         # creates tsconfig.json
Table of Contents

Download and Install Node.js

The first step to installing TypeScript is to download and install Node.js, which is a JavaScript runtime environment. You can download Node.js from the official website: https://nodejs.org/en/download/. Pick the current LTS release (Node.js 26 as of November 2026), run the installer and follow the instructions. npm comes with Node.js. Check both with node -v and npm -v.

Installing Node Version Manager

We recommend using Node Version Manager to manage your Node.js installation. We have provided detailed instructions on how to install NVM.

Install TypeScript Globally

After installing Node.js, you can install TypeScript using the Node Package Manager (npm). Open your command-line interface and run the following command to install TypeScript globally:

Terminalbash
npm install -g typescript

This command installs the latest TypeScript version globally on your machine. The TypeScript team recommends a per-project install for reproducible builds (see below), but a global install is handy for quick experiments. Once the installation is complete, verify it by running the following command:

Terminalbash
tsc --version

This command returns the installed TypeScript version, which is 7.0 or newer at the time of writing.

Install TypeScript per Project

To install TypeScript per project, navigate to the root directory of your project in the command line and run the following command:

Terminalbash
npm install typescript --save-dev

This command installs TypeScript as a dev dependency for your project, and the version is recorded in your lockfile, so everyone on the team uses the same one. Run the compiler with npx tsc, for example npx tsc --version.

Configure TypeScript

You can configure TypeScript by creating a tsconfig.json file in the root directory of your project. This file specifies the TypeScript compiler options for your project. To create a tsconfig.json file, run the following command:

Terminalbash
tsc --init

This command creates a basic tsconfig.json file. You can modify this file to suit your project requirements. Once a tsconfig.json exists, running tsc without any file names compiles the whole project. If you pass file names on the command line, tsconfig.json is ignored.

TypeScript 7.0 changed some defaults. For example, strict is now true by default and types defaults to [], so global type packages like node must be listed in types. Check the TSConfig reference for the current defaults.

TypeScript VSCode Setup

To get the most out of TypeScript development, it is recommended to use Visual Studio Code (VSCode) as your code editor. VSCode has many extensions that can improve your TypeScript development experience. Some popular extensions include:

  • ESLint - provides linting and code formatting for TypeScript.
  • Prettier - provides automatic code formatting for TypeScript.

These extensions can greatly improve your productivity and code quality when working with TypeScript in VSCode. All of these extensions are optional. This is because TypeScript is developed and maintained by Microsoft, as is VSCode, so VSCode comes with TypeScript support out-of-the-box. That includes IntelliSense, error highlighting and refactoring. Debugging in Chrome and Edge is built in as well, so you no longer need the old Debugger for Chrome extension.

VSCode does not include the TypeScript compiler tsc, so you still install it with npm as shown above. For TypeScript 7, the TypeScript team provides the TypeScriptTeam.native-preview extension, which switches the editor to the new language server. Check the TypeScript 7.0 announcement for the current editor status. TypeScript 7.0 also ships no compiler API, so tools like typescript-eslint need TypeScript 6.0 installed side by side. The announcement explains the setup.

We recommend using VSCode for TypeScript development. If you need help setting VSCode up, follow our instructions:

FAQ

Should I install TypeScript globally or per project?

Per project. The TypeScript team recommends a project-wide install for reproducible builds, and you run it with npx tsc. Use a global install (npm install -g typescript) only for quick experiments.

Does VSCode need the TypeScript compiler installed?

No for editing, yes for compiling. VSCode has built-in TypeScript language support, but it does not include the tsc compiler. Install typescript with npm to compile your code.

Why do I get tsc: command not found?

You most likely installed TypeScript per project, so tsc is not on your PATH. Run npx tsc instead, or install it globally with npm install -g typescript. Open a new terminal afterwards.

What changed in TypeScript 7.0?

The compiler is now a native port, and you still install it with npm install -D typescript. Defaults changed too: strict is true, types is [] and deprecated options such as target: es5 are now errors. It also ships no compiler API.

Conclusion

In conclusion, installing TypeScript is a simple process that involves installing Node.js, installing TypeScript using npm, and configuring TypeScript using a tsconfig.json file. Once you have completed these steps, you can start using TypeScript in your JavaScript projects. Happy coding!

whoami

Stefan founded Ceos3c in 2016 and has spent a decade teaching cybersecurity, Linux, and web development through hands-on tutorials. He builds and ships real products while sharing his journey: ProofSwap.me, XPMetric.com, and EasyEarningsTracker.com.

More about me