Interfaces and Abstract Classes in TypeScript
Interfaces are very good constructs in any programming language. An interface is a list of properties and methods a class to implement. If we are telling a class is implementing an interface, then that class must have all properties and should implement methods in interface.
Why Interfaces in TypeScript?
In TypeScript an interface can be used as a custom type. It means we can pass an interface as a type in the signature. That type can be used as a usual types as number and string, boolean.
interface Employee{
name: string;
id: number;
}
function getDetails() :Employee{
return {name: "Naren", id:20315};
}