# prefer-promise-reject-errors

Rule `typescript/prefer-promise-reject-errors`. Require using Error objects as Promise rejection reasons

- 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: #272 by reach, #1098 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/prefer-promise-reject-errors` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/prefer-promise-reject-errors) |
| Oxlint | `typescript/prefer-promise-reject-errors` | no | no | plugin `typescript`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/prefer-promise-reject-errors.html) |
| Biome | `nursery/usePromiseRejectErrors` | no | no | group nursery, since 2.5.15 | [docs](https://biomejs.dev/linter/rules/use-promise-reject-errors/) |

## Code examples

### Incorrect: the rule reports this

```ts
Promise.reject('error');

const err = new Error();
Promise.reject('an ' + err);

new Promise((resolve, reject) => reject('error'));

new Promise((resolve, reject) => {
  const err = new Error();
  reject('an ' + err);
});
```

### Correct: the rule accepts this

```ts
Promise.reject(new Error());

class CustomError extends Error {
  // ...
}
Promise.reject(new CustomError());

new Promise((resolve, reject) => reject(new Error()));

new Promise((resolve, reject) => {
  class CustomError extends Error {
    // ...
  }
  return reject(new CustomError());
});
```

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/prefer-promise-reject-errors": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/prefer-promise-reject-errors": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "usePromiseRejectErrors": "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

- [eslint/prefer-promise-reject-errors](https://lintradar.dev/rules/eslint/prefer-promise-reject-errors.md): Require using Error objects as Promise rejection reasons
- [typescript/only-throw-error](https://lintradar.dev/rules/typescript/only-throw-error.md): Disallow throwing non-`Error` values as exceptions
- [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-return](https://lintradar.dev/rules/typescript/no-unsafe-return.md): Disallow returning a value with type `any` from a function
- [typescript/restrict-plus-operands](https://lintradar.dev/rules/typescript/restrict-plus-operands.md): Require both operands of addition to be the same type and be `bigint`, `number`, or `string`
- [typescript/no-unnecessary-template-expression](https://lintradar.dev/rules/typescript/no-unnecessary-template-expression.md): Disallow unnecessary template expressions

---

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