src/content/docs/linter/rules/no-enum.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="TypeScript and TSX" icon="seti:typescript"> ## Summary - Rule available since: `v1.9.0` - Diagnostic Category: [`lint/style/noEnum`](/reference/diagnostics#diagnostic-category) - This rule isn't recommended, so you need to enable it. - This rule doesn't have a fix. - The default severity of this rule is [**warning**](/reference/diagnostics#warning). ## How to configure ```json title="biome.json" { "linter": { "rules": { "style": { "noEnum": "error" } } } }## Description
Disallow TypeScript enum.
TypeScript enums are not a type-level extension to JavaScript like type annotations or definitions.
Users may wish to disable non-type-level extensions to use bundlers or compilers that only strip types.
Const enums are not covered by this rule since `noConstEnum` already handles them.
Enums within the ambient context, including declaration files, are ignores as well.
## Examples
### Invalid
```ts
enum Foo {
BAR = 'bar',
BAZ = 'baz',
}
const Foo = {
BAR: 'bar',
BAZ: 'baz',
} as const
type Foo = 'bar' | 'baz'
const enum Foo {
BAR = 'bar',
BAZ = 'baz',
}