# restrict-plus-operands

Rule `typescript/restrict-plus-operands`. Require both operands of addition to be the same type and be `bigint`, `number`, or `string`

- Source: typescript
- Technologies: TypeScript
- Kind: suspicious
- Needs type information: yes
- Autofix: no
- Reach: 46.6M weekly downloads of presets that enable it
- Trend: +31.9% last quarter
- Rank: #274 by reach, #1100 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/restrict-plus-operands` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/restrict-plus-operands) |
| Oxlint | `typescript/restrict-plus-operands` | no | no | plugin `typescript`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/restrict-plus-operands.html) |
| Biome | `nursery/noUnsafePlusOperands` | no | no | group nursery, since 2.4.10 | [docs](https://biomejs.dev/linter/rules/no-unsafe-plus-operands/) |

## Code examples

### Incorrect: the rule reports this

```ts
let foo = 1n + 1;
let fn = (a: string, b: never) => a + b;
```

### Correct: the rule accepts this

```ts
let foo = 1n + 1n;
let fn = (a: string, b: string) => a + b;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/restrict-plus-operands": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/restrict-plus-operands": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noUnsafePlusOperands": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [typescript-eslint strict type-checked](https://lintradar.dev/presets/typescript-eslint-strict-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 75 | 175.9M | +29.5% |
| [typescript-eslint recommended type-checked](https://lintradar.dev/presets/typescript-eslint-recommended-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 47 | 175.9M | +29.5% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [typescript/prefer-reduce-type-parameter](https://lintradar.dev/rules/typescript/prefer-reduce-type-parameter.md): Enforce using type parameter when calling `Array#reduce` instead of using a type assertion
- [typescript/no-unsafe-assignment](https://lintradar.dev/rules/typescript/no-unsafe-assignment.md): Disallow assigning a value with type `any` to variables and properties
- [typescript/prefer-promise-reject-errors](https://lintradar.dev/rules/typescript/prefer-promise-reject-errors.md): Require using Error objects as Promise rejection reasons
- [typescript/no-unsafe-enum-comparison](https://lintradar.dev/rules/typescript/no-unsafe-enum-comparison.md): Disallow comparing an enum value with a non-enum value
- [typescript/only-throw-error](https://lintradar.dev/rules/typescript/only-throw-error.md): Disallow throwing non-`Error` values as exceptions
- [typescript/no-unsafe-member-access](https://lintradar.dev/rules/typescript/no-unsafe-member-access.md): Disallow member access on a value with type `any`

---

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