# oxc/no-const-enum

> Disallow TypeScript `const enum`

A `const enum` doesn't exist at runtime. TypeScript replaces each use with the member's value, and to do that it has to read the file that declares the enum. A tool that compiles one file at a time can't do that for an imported enum. If the enum is in a published `.d.ts` file, its values are copied into every package compiled against it, and they go stale when the enum changes.

`--fix` removes `const`, which makes it a regular enum.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"oxc/no-const-enum" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```ts
export const enum Status {
  Active,
  Archived,
}
```

Not reported:

{/* good */}
```ts
export enum Status {
  Active,
  Archived,
}
```

An object with `as const` gives you plain values without an enum:

{/* good */}
```ts
export const Status = {
  Active: 0,
  Archived: 1,
} as const;
```
