# @typescript-eslint/no-duplicate-enum-values

> Disallow two enum members with the same value

You can't tell two enum members with the same value apart at runtime. `Status.Active === Status.Enabled` is `true`, a `switch` only ever reaches the first `case`, and for numbers the reverse lookup `Status[1]` gives only the last name.

The rule only compares values written as a number, a string or a template without `${}`, with or without a `+` or `-` sign. It skips members without a value and computed values.

This rule is on by default in TypeScript files.

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

## Configure

On by default as a warning. To turn it off:

```toml bunfig.toml
[lint.rules]
"@typescript-eslint/no-duplicate-enum-values" = "off" # or "error"
```

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

## Examples

Reported:

{/* bad {"count": 2} */}
```ts
enum Status {
  Active = 1,
  Enabled = 1,
}

enum Color {
  Red = "red",
  Crimson = "red",
}
```

Not reported:

{/* good */}
```ts
enum Status {
  Active = 1,
  Disabled = 2,
}

enum Color {
  Red = "red",
  Crimson = "crimson",
}
```

A value that TypeScript fills in isn't compared. Here `Third` is `1` as well:

{/* good */}
```ts
enum Rank {
  First = 1,
  Second = 0,
  Third,
}
```
