Closed
Description
Expected behavior
No error.
Actual behavior
The type 'Float32ArrayConstructor' is undefined.
The type 'Uint32ArrayConstructor' is undefined.
ESLint Config
{
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["jsdoc"],
"rules": {
"jsdoc/no-undefined-types": "error"
},
"settings": {
"jsdoc": {
"mode": "typescript"
}
}
}
const ELEMENT_ARRAY_BUFFER = 0x8893;
const ARRAY_BUFFER = 0x8892;
/**
* Returns a typed array constructor based on the given buffer type
* @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.
* @return {Float32ArrayConstructor|Uint32ArrayConstructor} The typed array class to use for this buffer.
*/
export function getArrayClassForType(type) {
switch (type) {
case ARRAY_BUFFER:
return Float32Array;
case ELEMENT_ARRAY_BUFFER:
return Uint32Array;
default:
return Float32Array;
}
}
Environment
- Node version: v17.5.0
- ESLint version v8.0.0
eslint-plugin-jsdoc
version: 39.3.2
Details
When using "mode": "typescript"
it looks like TypeScript's built-in interface types are not recognized as defined types (e.g. the es2017 typed array types).
Let me know if you'd accept a pull request to add more extra/known types to the list used by the rule.