# no-inferrable-types

Rule `typescript/no-inferrable-types`. Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-inferrable-types` | no | safe | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-inferrable-types) |
| Oxlint | `typescript/no-inferrable-types` | no | safe | plugin `typescript`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-inferrable-types.html) |
| Biome | `style/noInferrableTypes` | no | safe | group style, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-inferrable-types/) |

## Code examples

### Incorrect: the rule reports this

```ts
const a: bigint = 10n;
const a: bigint = BigInt(10);
const a: boolean = !0;
const a: boolean = Boolean(null);
const a: boolean = true;
const a: null = null;
const a: number = 10;
const a: number = Infinity;
const a: number = NaN;
const a: number = Number('1');
const a: RegExp = /a/;
const a: RegExp = new RegExp('a');
const a: string = `str`;
const a: string = String(1);
const a: symbol = Symbol('a');
const a: undefined = undefined;
const a: undefined = void someValue;

class Foo {
  prop: number = 5;
}

function fn(a: number = 5, b: boolean = true) {}
```

### Correct: the rule accepts this

```ts
const a = 10n;
const a = BigInt(10);
const a = !0;
const a = Boolean(null);
const a = true;
const a = null;
const a = 10;
const a = Infinity;
const a = NaN;
const a = Number('1');
const a = /a/;
const a = new RegExp('a');
const a = `str`;
const a = String(1);
const a = Symbol('a');
const a = undefined;
const a = void someValue;

class Foo {
  prop = 5;
}

function fn(a = 5, b = 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/no-inferrable-types": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noInferrableTypes": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [typescript-eslint stylistic](https://lintradar.dev/presets/typescript-eslint-stylistic.md) | ESLint | `@typescript-eslint/eslint-plugin` | 17 | 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% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [typescript/prefer-for-of](https://lintradar.dev/rules/typescript/prefer-for-of.md): Enforce the use of `for-of` loop over the standard `for` loop where possible
- [typescript/consistent-type-definitions](https://lintradar.dev/rules/typescript/consistent-type-definitions.md): Enforce type definitions to consistently use either `interface` or `type`
- [typescript/class-literal-property-style](https://lintradar.dev/rules/typescript/class-literal-property-style.md): Enforce that literals on classes are exposed in a consistent style
- [typescript/no-dynamic-delete](https://lintradar.dev/rules/typescript/no-dynamic-delete.md): Disallow using the `delete` operator on computed key expressions
- [typescript/array-type](https://lintradar.dev/rules/typescript/array-type.md): Require consistently using either `T[]` or `Array<T>` for arrays
- [typescript/unified-signatures](https://lintradar.dev/rules/typescript/unified-signatures.md): Disallow two overloads that could be unified into one with a union or an optional/rest parameter

---

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