I am using TypeScript with Angular2, following is my class declaration -
export /**
* Stress
*/
class Student {
FirstName: string;
LastName: string;
constructor() {
}
get FullName() : string {
return this.FirstName + this.LastName;
}
}
When I try to initialize the above class using following code -
var stud1: Student = { FirstName:"John", LastName:"Troy" }
I am getting the following error -
Type '{ FirstName: string; LastName: string; }' is not assignable to type 'Student'.
Property 'FullName' is missing in type '{ FirstName: string; LastName: string; }'.
Any help please what I am doing wrong here, or it is not supported yet by TypeScript?