# ban-types

Rule `typescript/ban-types`. This rule bans specific types and can suggest alternatives. Note that it does not ban the corresponding runtime objects from being used.

- Source: typescript
- Technologies: TypeScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #470 by reach, #105 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Oxlint | `typescript/ban-types` | no | no | plugin `typescript`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/ban-types.html) |
| Biome | `complexity/noBannedTypes` | yes | safe | group complexity, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-banned-types/) |

## Code examples

### Incorrect: the rule reports this

```ts
let foo: String = 'foo';

let bar: Boolean = true;
```

### Correct: the rule accepts this

```ts
let foo: string = 'foo';

let bar: boolean = true;
```

Examples from the Oxlint documentation.

## Enable it

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/ban-types": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "complexity": {
        "noBannedTypes": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |

## Related rules

- [typescript/prefer-optional-chain](https://lintradar.dev/rules/typescript/prefer-optional-chain.md): Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects
- [typescript/switch-exhaustiveness-check](https://lintradar.dev/rules/typescript/switch-exhaustiveness-check.md): Require switch-case statements to be exhaustive
- [typescript/prefer-string-starts-ends-with](https://lintradar.dev/rules/typescript/prefer-string-starts-ends-with.md): Enforce using `String#startsWith` and `String#endsWith` over other equivalent methods of checking substrings
- [typescript/consistent-type-exports](https://lintradar.dev/rules/typescript/consistent-type-exports.md): Enforce consistent usage of type exports
- [typescript/consistent-type-imports](https://lintradar.dev/rules/typescript/consistent-type-imports.md): Enforce consistent usage of type imports
- [typescript/require-await](https://lintradar.dev/rules/typescript/require-await.md): Disallow async functions which do not return promises and have no `await` expression

---

Web page: https://lintradar.dev/rules/typescript/ban-types. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
