# no-useless-intersection

Rule `sonarjs/no-useless-intersection`. Type intersections should use meaningful types

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: yes
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1330 by reach, #631 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/no-useless-intersection` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-4335/) |

## Code examples

### Incorrect: the rule reports this

```js
function foo(p: MyType & null) { // Noncompliant
 // ...
}

function bar(p: MyType & any) { // Noncompliant
 // ...
}
```

### Correct: the rule accepts this

```js
function foo(p: MyType | null) {
 // ...
}
// or
function foo(p: MyType & AnotherType) {
 // ...
}

function bar(p: any) {
 // ...
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "sonarjs/no-useless-intersection": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/no-useless-increment](https://lintradar.dev/rules/sonarjs/no-useless-increment.md): Values should not be uselessly incremented
- [sonarjs/no-useless-react-setstate](https://lintradar.dev/rules/sonarjs/no-useless-react-setstate.md): React state setter function should not be called with its matching state variable
- [sonarjs/no-useless-catch](https://lintradar.dev/rules/sonarjs/no-useless-catch.md): "catch" clauses should do more than rethrow
- [sonarjs/no-vue-class-component](https://lintradar.dev/rules/sonarjs/no-vue-class-component.md): Vue components should not use the deprecated "vue-class-component" or "vue-property-decorator" libraries
- [sonarjs/no-use-of-empty-return-value](https://lintradar.dev/rules/sonarjs/no-use-of-empty-return-value.md): The return value of void functions should not be used
- [sonarjs/no-vue-mixins](https://lintradar.dev/rules/sonarjs/no-vue-mixins.md): Vue components should not use mixins

---

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