Constructors
Inheritance
Interfaces
Interface is a model of a class.
Interface contains list of properties and methods, that are to be implemented in a class.
Class implements the interface and provides definition for interface methods.
Interface
interface interfacename
{
property : datatype;
method( ) : returntype;
}
Child Class
class classname implements interfacename
{
property : datatype;
method( ) : returntype
{
}
}
Modules
Modules in TypeScript
In TypeScript, a "Module" is a file, that exports one or more classes (or others) to other modules.
ModuleA.ts
export class classname
{
}
ModuleB.ts
import { classname } from "./ModuleA";
var variable: classname;