Show Menu
Cheatography

Typescript Cheat Sheet (DRAFT) by [deleted]

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Types

String
Number
Boolean
Date
Any
Enum
Array
Null
Tuple
let stateT­­ax­R­ates: [string, number];
Like Map
Void
Const

Class Syntax

class OrderLogic {

    constructor(public order: IOrder) { }

    // Metod Example
    getOrderTotal(): number {

        let sum: number = 0;

        for (let orderDetail of this.order.orderDetails) {
            sum += orderDetail.price;
        }
        return sum;
    }
}
export class kullanımı :