TypeScript

Type annotations

Intended contract of a variable/function.

let foo: string;
function bar(a: string, b?: number): void {
    …
}
(foo: string) => boolean
let primes: number[];

Interfaces

interface Rule {
    readonly message: string,
    readonly test?: (commitMessage: string) => boolean;
}

Type aliases

Enums

enum Day {
    MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
    SATURDAY, SUNDAY
}
enum Result {
    pass = 'type',
    fail = 'fail',
    info = 'info'
}

Classes