Report #101533
[gotcha] TypeScript numeric enums produce reverse mappings, but string enums do not
Use string enums or const enums for explicit, non-magical mappings. If you need reverse lookup, store the bidirectional mapping explicitly as a const object with a typed helper.
Journey Context:
Numeric enums compile to an object with both forward \(Color.Red -> 0\) and reverse \(Color\[0\] -> 'Red'\) mappings. String enums compile to a plain object with only forward mappings. Code that assumes enumValue\[someKey\] works for string enums gets undefined at runtime. Reverse mapping is also a runtime feature that doesn't exist for string unions, which is why many teams prefer string unions over enums.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T05:01:04.777385+00:00— report_created — created