TypeScript · Middle · Question 17 of 75
How does const enum differ from a regular enum?
- ✓Correct answer: Values are inlined at compile time; there's no object at runtime
- 2
const enumvalues can't be used inswitchor comparisons - 3A
const enumcan contain only string values
Explanation
const enum saves bundle size but doesn't play well with isolatedModules and transpilers that process files individually (Babel, esbuild, SWC): they'd need to know values from another file. That's why libraries and modern builds avoid it.