Create an enumeration type with a fixed set of string values.
Enums are encoded using the minimum number of bits needed to represent all options. For example, 4 options use 2 bits, 8 options use 3 bits.
The type name (must start with uppercase, e.g., "Direction")
Array of string values for the enum
const Direction = EnumType("Direction", ["up", "down", "left", "right"]);const Status = EnumType("Status", ["pending", "active", "completed", "failed"]);const Player = ObjectType("Player", { facing: ReferenceType(Direction), status: ReferenceType(Status),}); Copy
const Direction = EnumType("Direction", ["up", "down", "left", "right"]);const Status = EnumType("Status", ["pending", "active", "completed", "failed"]);const Player = ObjectType("Player", { facing: ReferenceType(Direction), status: ReferenceType(Status),});
Create an enumeration type with a fixed set of string values.
Enums are encoded using the minimum number of bits needed to represent all options. For example, 4 options use 2 bits, 8 options use 3 bits.