# no-unnecessary-type-assertion

Rule `jsdoc/no-unnecessary-type-assertion`. Reports redundant @type tags that match or broaden the naturally inferred TypeScript type.

- Source: jsdoc
- Technologies: JSDoc
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2099 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jsdoc/no-unnecessary-type-assertion` | no | safe | package `eslint-plugin-jsdoc` | [docs](https://github.com/gajus/eslint-plugin-jsdoc) |

## Code examples

### Incorrect: the rule reports this

```ts
/**
 * @type {5}
 */
const a = 5;
```

### Correct: the rule accepts this

```ts
/**
 * @param {boolean} a
 */
function quux (a) {
  /**
   * @type {true}
   */
  const b = a;
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
import jsdoc from "eslint-plugin-jsdoc";

export default [
  {
    plugins: { jsdoc },
    rules: {
      "jsdoc/no-unnecessary-type-assertion": "error",
    },
  },
];
```

## Related rules

- [typescript/no-unnecessary-type-assertion](https://lintradar.dev/rules/typescript/no-unnecessary-type-assertion.md): Disallow type assertions that do not change the type of an expression
- [jsdoc/no-restricted-syntax](https://lintradar.dev/rules/jsdoc/no-restricted-syntax.md): Reports when certain comment structures are present.
- [jsdoc/normalize-see-links](https://lintradar.dev/rules/jsdoc/normalize-see-links.md): Normalizes labeled links in `@see` tags to a canonical `{@link}` form.
- [jsdoc/no-missing-syntax](https://lintradar.dev/rules/jsdoc/no-missing-syntax.md): Reports when certain comment structures are always expected.
- [jsdoc/prefer-import-tag](https://lintradar.dev/rules/jsdoc/prefer-import-tag.md): Prefer `@import` tags to inline `import()` statements.
- [jsdoc/match-name](https://lintradar.dev/rules/jsdoc/match-name.md): Reports the name portion of a JSDoc tag if matching or not matching a given regular expression.

---

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