Skip to content
public-library›Rules›TypeScript›Prefer literal unions over enums

Prefer literal unions over enums

Represent a fixed set of values with a union of string literals. When code also needs the values at runtime, derive the union from an as const array or object.

In the full rule