Typescript in Angular Js

Install Typescript:

To check the Typescript version:

Typescript is just a superset of JavaScript. It is client side object oriented language. It follows classes, objects, Inheritance, Interface etc.. object oriented concepts like in Java or .net.

A valid JavaScript code is also valid typescript code. Because when you compile the typescript code it create a JavaScript file.


when you compile this main.ts file like:

a new file will generated here named as main.js.

if you are running an angular application it will be done automatically done by angular webpack we don't need to manually call ts complier.

When you run following commands:
1) ng serve
2) npm start
Typescript compiler called automatically and convert typescript code to JavaScript code.

if you check main.js it will have the JavaScript code like:

if you will run below command:

it  will print "Coding 4 Developers".

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *