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:
You can check TypeScript version:
Testing TypeScript
Create a main.ts
file:
Add the following code in a file:
Convert TypeScript code to JavaScript:
A new file named main.js
is generated. Now you can run it with node
command:
Uninstall TypeScript
You can completely remove TypeScript using the following command: