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.
ts-nodemodule. 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.
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.
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
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.