TypeScript Setup

Below are the tools you need to set up with the environment to start writing TypeScript code:

  • Node.js – Node.js is the environment in which you will run the TypeScript compiler.
  • TypeScript compiler – a Node.js module that compiles TypeScript into JavaScript. If you use JavaScript for node.js, you can install the ts-node module. It is a TypeScript execution and REPL for node.js
  • Visual Studio Code – It is a code editor that supports TypeScript. However, you can use your favourite editor.

If you use VS Code, you can install the following extension to speed up the development process:

  • Live Server – It allows you to launch a development local Server with the hot reload feature.

Install Node.js

Installing node.js is very simple. You just need to follow the below steps –

  • Download the latest node.js version from the official website
  • Execute the downloaded package and follow the steps.
  • Verify the installation from your terminal. by executing the command node -v. If you see the version you downloaded, it means the installation is successful.

Install TypeScript

Once you install the Node, you can install the typescript compiler using the following command from the command prompt

npm install -g typescript

Install Visual Studio Code

Next, we will need a Code editor. You have many choices here. For this tutorial, we will use Visual Studio Code. You can download it from the official  https://code.visualstudio.com/download

Visual Studio Code

Configure Visual Studio Code (IDE) for JavaScript Development

You can read my previous post to know how you can set up your Visual Studio Code for JavaScript development. It is valid for TypeScript as well.

How to configure Visual Studio Code (IDE) for JavaScript Development

Install Live Server 

To install the Live Server extension, you follow these steps:

  • Click the Extensions tab to find the extensions for VS Code.
  • Type the live server to search for it.
  • Click the install button to install the extension.

0 Comments

Submit a Comment

Your email address will not be published.