Install Typescript:
1
|
sudo npm install -g typescript
|
To check the Typescript version:
1
|
tsc --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.
Example:
1
2
3
4
5
6
7
|
function log(message){
console.log(message);
}
var message = 'Coding 4 Developers';
log(message);
|
when you compile this main.ts file like:
1
|
tsc main.ts
|
a new file will generated here named as main.js. ...