# prefer-reduce-type-parameter

Rule `typescript/prefer-reduce-type-parameter`. Enforce using type parameter when calling `Array#reduce` instead of using a type assertion

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/prefer-reduce-type-parameter` | no | safe | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/prefer-reduce-type-parameter) |
| Oxlint | `typescript/prefer-reduce-type-parameter` | no | safe | plugin `typescript`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/prefer-reduce-type-parameter.html) |
| Biome | `style/useReduceTypeParameter` | no | unsafe | group style, since 2.4.12 | [docs](https://biomejs.dev/linter/rules/use-reduce-type-parameter/) |

## Code examples

### Incorrect: the rule reports this

```ts
[1, 2, 3].reduce((arr, num) => arr.concat(num * 2), [] as number[]);

['a', 'b'].reduce(
  (accumulator, name) => ({
    ...accumulator,
    [name]: true,
  }),
  {} as Record<string, boolean>,
);
```

### Correct: the rule accepts this

```ts
[1, 2, 3].reduce<number[]>((arr, num) => arr.concat(num * 2), []);

['a', 'b'].reduce<Record<string, boolean>>(
  (accumulator, name) => ({
    ...accumulator,
    [name]: true,
  }),
  {},
);
```

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-reduce-type-parameter": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/prefer-reduce-type-parameter": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useReduceTypeParameter": "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% |
| [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% |
| [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-promise-reject-errors](https://lintradar.dev/rules/typescript/prefer-promise-reject-errors.md): Require using Error objects as Promise rejection reasons
- [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/only-throw-error](https://lintradar.dev/rules/typescript/only-throw-error.md): Disallow throwing non-`Error` values as exceptions
- [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/no-unsafe-return](https://lintradar.dev/rules/typescript/no-unsafe-return.md): Disallow returning a value with type `any` from a function
- [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

---

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