TypeScript Tutorial

JavaScript is the name that many people hear in web development community, but JavaScript is a subset of one of the powerful scripting language, which is TypeScript. TypeScript provides more powerful features like classes, inheritance, etc., of object oriented programming.

TypeScript has come to light when Angular team developers has opted TypeScript for JavaScript for its rich features.

Get Started with TypeScript

To work with typescript, NodeJS and TypeScript are required. You may use any text editor to create a .ts file and use tsc command in cmd prompt to compile ts file to js file. One can also consider an IDE like Visual Studio Code that could help write TypeScript with ease.

Install Node

Based on your OS version, you can download node from [https://nodejs.org/en/] and run the installer that guides you through simple steps. To verify if node is installed, run node -v command in cmd prompt. node command should echo the version of node that is installed.

NodeJS Version

Install TypeScript

With node installed, we get npm installed inclusively. Open a command prompt as administrator and run the following command to install TypeScript compiler globally using npm :

npm install -g typescript

To verify if typescript is installed successfully, run tsc -v in command prompt from any folder location. It should echo back the version of typescript being used as shown in the below screenshot.

TypeScript Version

TypeScript Tutorials

We are done with the environment setup for TypeScript. Now, we shall cover the different concepts in TypeScript.

How to Run TypeScript Code?

In these series of TypeScript tutorials, we will compile the typescript code (.ts) files to JavaScript code (.js) files. So you can run these JavaScript files using node command or you can also include this code in a html file and run in a browser. While you have an option, in these tutorials, we will provide you the both the outputs from a browser and node execution.

TypeScript Conditional Statements

Conditional statement executes a block of statement based on an expression’s value. The branching of this execution can happen in many ways, and TypeScript provides statements for realizing this conditional branching of execution flow :

TypeScript Looping Statements

Often it is required to execute a task repeatedly based on a condition. TypeScript provides for, while and do-while to execute looping program structures.


In this TypeScript Tutorial, we have learnt what TypeScript is, what are its advantages over JavaScript, and setup the environment for TypeScript Application development.