profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

TypeScript Type Alias

Description

The make your own Sundae of Types.

Sytax

type StrOrNum = string | number

// Usage: just like any other notation
var sample: StrOrNum
sample = 123
sample = "123"

// Just checking
sample = true // Error!
type Text = string | { text: string }
type Coordinates = [number, number]
type Callback = (data: string) => void