jsdoc: JSDoc doesn't generete doc for ES6 functions like export const myFunction = ( ) => ........
Input code
When you declare an arrow function with an export like:
/**
* Description.
* @param {object} userInfo description
*/
export const setUserInfo = userInfo => ({ userInfo });
The generated documentation takes it like a constant while removing the export
the documentation is generated fine.
JSDoc configuration
Default configuration
JSDoc debug output
No output
Expected behavior
Current behavior
Your environment
Software | Version |
---|---|
JSDoc | 3.5.5 |
Node.js | 8.9.4 |
npm | 5.7.1 |
Operating system | Windows 10 |
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 19
- Comments: 17
I was with the same problem and I didn’t find a solution. I have a utils file with multiple exported functions and the ‘export default’ solution didn’t be good in my case. I resolved that putting @method above the @params. Like this:
I don’t if it’s the best solution but I hope to help people with the same issue.
Facing same issue with JSDoc 3.6.4.
Adding
/** @module moduleName */
at the top of the file doesn’t solve the issue. Only viable solution so far is using@function
, which is a bit annoying.I wonder if we are doing something wrong or if this is an actual bug.
I encounter the same kind of issue when you declare a class in the export section. ie:
The best solution to address this, is to declare and export separately :
and I got a documentation’s result close to what you wanted:
Has there been any update on this? I’m trying to write a codebase in valid, standard ES2015 (standardized in 2015 I believe) and have typing support, but there doesn’t seem to be any tooling that supports it!
Exporting default doesn’t work, because one then can’t import specific symbols using the import syntax.
There is problem with the (arrow or regular) function expression exported (without tag
@function
,@func
or@method
).Input code
JSDoc
Is adding the
@function
decorator still the best solution for this? Thoughts, all?Yes the JS file