-
-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Labels
Description
The TypeScript assertion functions is not recognized by the require-returns-check rule.
Expected behavior
No errors from this plugin.
Actual behavior
Rule https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-check reports:
JSDoc @returns declaration present but return expression not available in function.
ESLint sample
This code narrows the type of maybeNum to number:
/** @type {number | string | undefined} */
let maybeNum;
/**
* @param {unknown} val
* @returns { asserts val is number }
*/
function assertNumber(val) {
assert(typeof val === 'number');
}
assertNumber(maybeNum);
maybeNum.toFixed;Environment
- Node version: v18.7.0
- ESLint version v7.32.0
eslint-plugin-jsdocversion: 39.3.3