eightminuseight icon

interface with many types

eightminuseight | PRO | 10/05/16 07:42:18 PM UTC | 0 ⭐ | 230 👁️ | Never ⏰ | []
JavaScript |

540 B

|

None

|

0 👍

/

0 👎

// simple interface
interface TallPerson {
    firstName: string;
    lastName: string;
    middleInit?: string;    // optional property
    readonly x: number;     // only be modifiable when an object is first created
    (source: string, subString: string): boolean;   // a function type - only defines params and return types
    [index: number]: string;    // Indexable types to describe array. index sig describes types i.e.:["Bob", "Fred"]
    [propName: string]: any;    // index signature - object can have any number of additional props and still be valid
}

Comments