# no-undefined-types

Rule `jsdoc/no-undefined-types`. Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`.

- Source: jsdoc
- Technologies: JSDoc
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 8.1M weekly downloads of presets that enable it
- Trend: +23.8% last quarter
- Rank: #1147 by reach, #1376 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `jsdoc/no-undefined-types` | yes | no | package `eslint-plugin-jsdoc` | [docs](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header) |

## Code examples

### Incorrect: the rule reports this

```ts
/** @typedef {{id: number}} User */
```

### Correct: the rule accepts this

```ts
/**
 * @param {string} foo - Bar.
 */
function quux(foo) {
```

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-undefined-types": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [JSDoc recommended](https://lintradar.dev/presets/jsdoc-recommended.md) | ESLint | `eslint-plugin-jsdoc` | 37 | 8.1M | +23.8% |

## Related rules

- [jsdoc/require-returns-type](https://lintradar.dev/rules/jsdoc/require-returns-type.md): Requires that `@returns` tag has type value (in curly brackets).
- [jsdoc/require-param-type](https://lintradar.dev/rules/jsdoc/require-param-type.md): Requires that each `@param` tag has a type value (in curly brackets).
- [jsdoc/require-jsdoc](https://lintradar.dev/rules/jsdoc/require-jsdoc.md): Checks for presence of JSDoc comments, on functions and potentially other contexts (optionally limited to exports).
- [jsdoc/require-returns](https://lintradar.dev/rules/jsdoc/require-returns.md): Requires that returns are documented with `@returns`.
- [jsdoc/valid-types](https://lintradar.dev/rules/jsdoc/valid-types.md): Requires all types/namepaths to be valid JSDoc, Closure compiler, or TypeScript types (configurable in settings).
- [jsdoc/ts-no-empty-object-type](https://lintradar.dev/rules/jsdoc/ts-no-empty-object-type.md): Warns against use of the empty object type

---

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