← All notes

TypeScript enums

Short answer

Enums define a set of named constants. TypeScript supports numeric and string enums; they exist as real objects at runtime. Union and literal types are often a lighter alternative. [S1][S2]

Points

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

Source notice: TypeScript Handbook / Website docs © Microsoft. Licensed under Creative Commons Attribution 4.0 International (https://github.com/microsoft/TypeScript-Website/blob/v2/LICENSE).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Microsoft (TypeScript Handbook), TypeScript: Handbook - Enums, CC BY 4.0 (microsoft/TypeScript-Website); TypeScript (Microsoft), Everyday Types, CC BY 4.0 (microsoft/TypeScript-Website).

Cite this

Permanent ID: iil:note:gqfg9rnh

iinventedlight. 2026. "TypeScript enums: named constants, numeric or string." iinventedlight Library, iil:note:gqfg9rnh, version of 2026-11-04. https://iinventedlight.com/library/notes/typescript-enums/. License: CC-BY-4.0.

@misc{iil_note_gqfg9rnh,
  author = {{iinventedlight}},
  title = {{TypeScript enums: named constants, numeric or string}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/typescript-enums/},
  note = {Permanent ID iil:note:gqfg9rnh. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/typescript-enums.md.