-
-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Labels
Description
This is about types inside brackets, specifically type {function()}
, used e.g. with @Property or @param or @returns.
Expected behavior
A return type should not be necessary on function()
types:
In general, but also especially when the return type is "undefined"
"jsdoc3" in particular only writes "function" into the HTML output and ignores the types, so this is doubly useless to have to write the lengthy ":undefined" every time.
Code example:
/**
* @typedef {object} ExporterOptions
* @property {function(string)} logSentObject
* @property {function(Error)} logError - Log Errors
*/
Error message example:
The error disappears when I add ":undefined" to the end of each function type.
exporter.ts
19:0 error Syntax error in type: function(string) jsdoc/valid-types
20:0 error Syntax error in type: function(Error) jsdoc/valid-types
ESLint Config
Config includes 'jsdoc/valid-types': 'error'
Project files are typescript and I set settings.jsdoc.mode to "typescript" (or left it empty as an experiment).
When I set "mode" to "jsdoc" the error disappears.
Environment
- Node version: v16.4.0
- ESLint version v7.29.0
eslint-plugin-jsdoc
version: v35.4.0