Common Data Types
stringnumber
boolean
any - when we don't care what the type is
Using Data Types
export class MyClass {
      name: string = "Test";
}
Functions
export class MyClass {
      doSomething(name: string) : void {
}
}
}
Interface
export interface IMyClass {
    name: string;
    code: string;
    doSomething(name: string) : void
}
Class Inheriting from Interface
import { IMyClass } from './myClass';
export class MyClass implements IMyClass {
    constructor(name: string, code: string) {
    }
    doSomething(name: string) : void { ... }
}
 
 
No comments:
Post a Comment