type (Keyword)

type declares an alias, tagged union or record type. Here UserId names int, Status has two variants, and User has named fields.

Example

type UserId = int
type Status = Active | Inactive
type User = { name: string, age: int }
type UserId =
    int

type Status =
    Active
    Inactive

type User =
    name : string
    age : int