Typescript datatypes
From wikinotes
Primitives
string number boolean
Collections
Arrays
function print(names: string[]): null { console.log(names); }Sets
Objects
You can define sort-of anonymous interfaces, based on the properties you require.
function volume(coords: { x: number; y: number; z: number; }): number { // ... }Maps
Typing
Type Aliases
type Point = { x: number y: number } function area(pt: Point): number { return pt.x * pt.y; }Any
any
can refer to any object.Unions
A param accepting a variety of types.
function print(msg: number | string | boolean): null { console.log(msg) }