I am learning Angular4 and going through the tutorial examples.
https://angular.io/docs/ts/latest/tutorial/toh-pt1.html
I have the below code in the tutoria
I would say it is kind of interface but instead of implementing it you can use this class as a type:
export class Hero {
id: number; // *2
name: string;
}
let a: Hero = 'some call to create new hero';
It will ensure that the object is a type anything else will be cause
in type error.
Here you can see it is been used as a type to create a new Hero of type Hero:
hero: Hero = {
id: 1,
name: 'Windstorm'
};