Extend modern javascript language, that help you scale your app.
Basic Types
Is a way very generic for define the variables
most strict
Use Cases
Other Types
are definitions
of concepts
There are classes in TtypeScript !
Of course
class User {
constructor (name,age){
this.name = name;
this.age = age;
}
getName(){
return this.name;
}
getAge(){
return this.age;
}
}
let user1 = new User("John",22);
let user2 = new User("Pedro",24);
Classes in ES6
class User {
private name : string;
private age : number;
constructor (name:string,age:number){
this.name = name;
this.age = age;
}
getName(){
return this.name;
}
getAge(){
return this.age;
}
}
let user1 = new User("John",22);
let user2 = new User("Pedro",24);
Classes in TS
http://rockalabs.com
jdmorales092@gmail.com