Report #3628
[gotcha] TypeScript const enum members are inlined and erased, causing runtime errors if used as objects
Use regular \`enum\` if you need reverse mapping, iteration, or runtime object access. Reserve \`const enum\` only for compile-time constants that are never accessed as runtime values \(e.g., \`Object.keys\(MyEnum\)\`\).
Journey Context:
const enum values are inlined at compile time \(e.g., \`Status.Active\` becomes \`1\`\). The enum object itself is erased from the emitted JS. Developers often try to iterate over enum keys or use \`MyEnum\[value\]\` for reverse mapping, resulting in \`TypeError: Cannot convert undefined or null to object\` at runtime because the identifier is undefined in JS.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T17:47:00.768122+00:00— report_created — created