/** * Mimics Sway Enum. * Requires one and only one Key-Value pair and raises error if more are provided. */ export type Enum = { [K in keyof T]: Pick & { [P in Exclude]?: never; }; }[keyof T]; /** * Mimics Sway Option and Vectors. * Vectors are treated like arrays in Typescript. */ export type Option = T | undefined; export type Vec = T[]; /** * Mimics Sway Result enum type. * Ok represents the success case, while Err represents the error case. */ export type Result = Enum<{ Ok: T; Err: E; }>;