Brief Introduction of TypeScript
Typescript is a strongly-typed superset of JavaScript and it
makes more readable and maintainable. This is an open-source language created by
Microsoft. Way of the writing syntax similar is C# oop’s concept. Typescript can be used for cross-browser
development.
What are the features?
- It
is a strong type language and similar to oop’s Concept
- It supports
Access Modifiers and Properties
- It
supports data Types
- It
supports modules and classes
- It
supports Static and Instant member
- It
supports Function Overloading and Constructor
- It
supports Inheritance
- It
supports Modules
- It
supports Template string
- It
supports interfaces
- It
supports generics
- Typescript Code is Converted into Plain JavaScript Code
How to Install
We can install two ways of typescript
- Using npm(Node.js Package Manager)
- Install in Visual Studio
How to install
using npm
First, we have to install the
node.js. Download it from this location
Now we can check it has installed or not of below
command so go start and search Node.js command prompt and write below command
node –v
It will display the version of
the installed node.js.
Then use below command in
command prompt to install the Typescript
npm install -g typescript
How to install in
visual studio
We have to go below
following location
After that, we will see a window
And click the download button
And start the install after download
After that click run button
After that click install button -> Click Yes button
After completing Installation how can we check
in visual studio, it is installed or not
First, open visual studio and go to help option in the menu
And also we can check
Way of writing
syntax
We can see first how can write in javaScript
var number1 = 5;
var number2 = 5;
var str = "Hello";
var something = 890;
var lst = [1, 2, 3, 4, 5];
function Add(number1, number2) {
return
number1 + number2;
}
We can see first how can write in TypeScript
var number1: number =5;
var number2: number =5;
var str: string = "Hello";
var something = 890;
var lst: Array<number> = [1,2,3,4,5]
function Add(number1: number,number2: number){
return number1
+ number2;
}
No comments:
Post a Comment