Skip to content

oxc/no-const-enum Restriction

🛠️ An auto-fix is available for this rule.

What it does

Disallow TypeScript const enum

Why is this bad?

Const enums are enums that should be inlined at use sites. Const enums are not supported by bundlers and are incompatible with the isolatedModules mode. Their use can lead to import nonexistent values (because const enums are erased).

Example

ts
const enum Color {
  Red,
  Green,
  Blue,
}

References

Released under the MIT License.