Recent Post

Prepare Environment and Installing Typescript in Ubuntu 22.04



TypeScript is a programming language that enhances JavaScript by adding extra features. TypeScript code is transformed into JavaScript, which can then be run on various platforms that support JavaScript, such as web browsers and Node.js.

This tutorial shows how to install TypeScript on Ubuntu 20.04.

Prepare environment

Make sure you have installed Node.js and npm. You can read post how to install them.

Install TypeScript

Run the following command to install TypeScript:

sudo npm install -g typescript

You can check TypeScript version:

tsc --version

Testing TypeScript

Create a main.ts file:

nano main.ts

Add the following code in a file:

console.log('Hello world');

Convert TypeScript code to JavaScript:

tsc main.ts

A new file named main.js is generated. Now you can run it with node command:

node main.js

Uninstall TypeScript

You can completely remove TypeScript using the following command:

sudo npm uninstall -g typescript