A [[TypeScript]] design pattern. This is preferred over the `enum`s as this is a type-only construct. ```typescript type Color = "red" | "blue" ``` This is a type-only construct. However, if you want to access this in runtime (say, to perform a validation), one can define an array with `as const`. ```typescript const AllColors = ["red", "blue"] as const; type Color = (typeof AllColors)[number]; // Same as the above. ``` With this, a typeguard can be implemented: ```typescript export function isEnum<T extends string>(all: readonly T[], raw: string): raw is T { return all.includes(raw as T); } if (isEnum(AllColors, x)) { // x is "red" or "blue" } ```