Shape

tcmts.core.shape.Shape · #phb2h5li · type

export type Shape =
  | { k: "prim"; name: string }
  | { k: "lit"; value: string | number | boolean }
  | { k: "var"; i: number }
  | { k: "fn"; params: Shape[]; rest?: Shape; ret: Shape }
  | { k: "array"; of: Shape }
  | { k: "tuple"; of: Shape[] }
  | { k: "union"; of: Shape[] }
  | { k: "inter"; of: Shape[] }
  | { k: "obj"; props: [string, Shape, boolean][] }
  /** a codebase type, by hash */
  | { k: "ref"; hash: string; args: Shape[] }
  /** a type from a library (Promise, Map, Date, a package's types), by name */
  | { k: "named"; name: string; args: Shape[] }
  /** too deep or too big to compare */
  | { k: "opaque" };

used by