Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule jsdoc/no-undefined-types reports the type IterableIterator is undefined #1066

Closed
jaydenseric opened this issue May 8, 2023 · 3 comments

Comments

@jaydenseric
Copy link
Contributor

Expected behavior

The following:

// @ts-check

const messages = [];

for (const [index, message] of /** @type {IterableIterator<[number, unknown]>} */ (messages.entries())) {
  // …
}

Should not result in a rule jsdoc/no-undefined-types error.

Actual behavior

It results in the error:

The type 'IterableIterator' is undefined.

ESLint Config

{
  "extends": "plugin:jsdoc/recommended-typescript-error",
  "settings": {
    "jsdoc": {
      "mode": "typescript"
    }
  },
}

ESLint sample

// @ts-check

const messages = [];

for (const [index, message] of /** @type {IterableIterator<[number, unknown]>} */ (messages.entries())) {
  // …
}

Environment

  • Node version: v20.0.0
  • ESLint version v8.39.0
  • eslint-plugin-jsdoc version: v43.1.1
@brettz9
Copy link
Collaborator

brettz9 commented May 8, 2023

Closing as a dupe of #888 though feel free to comment further as needed.

@brettz9 brettz9 closed this as completed May 8, 2023
@jaydenseric
Copy link
Contributor Author

Why does the config plugin:jsdoc/recommended-typescript-error enable the jsdoc/no-undefined-types rule, when TypeScript itself reports errors for invalid JSDoc types? Is an easy fix for this issue to turn it off in the recommended TypeScript config, and regarding #888, to make the rule jsdoc/no-undefined-types a no-op in TypeScript mode?

@brettz9
Copy link
Collaborator

brettz9 commented May 8, 2023

@jaydenseric : SGTM. How about you re-post your comment in #888 so others may chime in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants