Skip to content

Latest commit

 

History

History
10 lines (9 loc) · 1.32 KB

File metadata and controls

10 lines (9 loc) · 1.32 KB

typescript-flow-haskell-types-comparison

Type Haskell TypeScript Flow JsDoc JSON Schema
Union data Shape = Circle | Triangle type Shape = CircleInterface | TriangleInterface var Shape: CircleVar | TriangleVar `({x: number, y: number, r: number} {{x: number, y: number, a: number, b: number, c: number}})`
Product Data Circle = Int Int Int interface Circle {x: number; y: number; radius: number } var Circle = {x: number, y: number, radius: number} {{x: number; y: number; radius: number}} type: "object", properties: {x: "number", y: "number", radius: "number"}
Nullable Maybe type type T1 = (x?: number) var Salary = ?number {?number} Depends on parser, either type: null if it supports undefined as well or using required
Non-nulalble - let s = e!.name ? {!{number}} -
Discriminated union Pattern matching in type constructor Understanding context Understanding context - -
Generics data Maybe a = Nothing | Just a interface GenericObject<T> {foo: T;} type GenericObject<T> = { foo: T }; - -