Expected behavior
The no-undefined-types rule does not report an error if the variables Iterable and IteratorObject are used in the JSDoc.
tsc knows these two types and doesn't report any errors when they're used in a TypeScript file.
Actual behavior
/home/regseb/testcase/index_jsdoc.js
2:1 error The type 'Iterable' is undefined jsdoc/no-undefined-types
3:1 error The type 'IteratorObject' is undefined jsdoc/no-undefined-types
Files
eslint.config.js
import jsdoc from "eslint-plugin-jsdoc";
export default [
{
plugins: { jsdoc },
rules: {
"jsdoc/no-undefined-types": "error",
}
}
];
index_jsdoc.js
/**
* @param {...Iterable<any>} its
* @returns {IteratorObject<any>}
* @see https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Iterator/concat
*/
const concatIteratorJSDoc = (...its) => {
return Iterator.from(its.flat());
};
index_typescript.ts
const concatIteratorTypeScript = (...its: Iterable<any>[]): IteratorObject<any> => {
return Iterator.from(its.flat());
};
package.json
{
"name": "testcase",
"version": "1.0.0",
"type": "module",
"dependencies": {
"eslint": "10.5.0",
"eslint-plugin-jsdoc": "63.0.6",
"typescript": "6.0.3"
}
}
Steps
npm i
npx eslint
/home/regseb/testcase/index_jsdoc.js
2:1 error The type 'Iterable' is undefined jsdoc/no-undefined-types
3:1 error The type 'IteratorObject' is undefined jsdoc/no-undefined-types
✖ 2 problems (2 errors, 0 warnings)
npx tsc --noEmit index_typescript.ts
Environment
- Node version: v26.3.1
- ESLint version: v10.5.0
eslint-plugin-jsdoc version: 63.0.6
Expected behavior
The
no-undefined-typesrule does not report an error if the variablesIterableandIteratorObjectare used in the JSDoc.tscknows these two types and doesn't report any errors when they're used in a TypeScript file.Actual behavior
Files
eslint.config.jsindex_jsdoc.jsindex_typescript.tspackage.json{ "name": "testcase", "version": "1.0.0", "type": "module", "dependencies": { "eslint": "10.5.0", "eslint-plugin-jsdoc": "63.0.6", "typescript": "6.0.3" } }Steps
npm inpx eslintnpx tsc --noEmit index_typescript.tsEnvironment
eslint-plugin-jsdocversion: 63.0.6