TypeScript · Middle · Question 17 of 75

How does const enum differ from a regular enum?

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.

Further reading

Problem with a question

TypeScript · Middle · question 17

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz