No automatic default values for arguments in functions exported from ES2015 module.
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 15.5k
- Forks
- 1.5k
- Avg merge
- 10d 23h
- Merged PRs (30d)
- 1
Description
Input code
/**
* Test function.
* @param {string} [arg] - Test argument.
*/
export function test(arg = 'default_value') {}
JSDoc configuration
Default.
JSDoc debug output
DEBUG: JSDoc 4.0.0 (Thu, 03 Nov 2022 18:37:15 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":[],"recurseDepth":10,"source":{"includePattern":".+\\.js(doc|x)?$","excludePattern":"(^|\\/|\\\\)_"},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"default":{"outputSourceFiles":true}}},"opts":{"_":["test.js"],"debug":true,"destination":"./out/","encoding":"utf8"}}}
DEBUG: Parsing source files: ["/mnt/storage/jsdoc_bug/test.js"]
Parsing /mnt/storage/jsdoc_bug/test.js ...
DEBUG: Finished parsing source files.
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...
Finished running in 0.81 seconds.
Expected behavior
default column in the generated documentation exists and has values.
Current behavior
No default column in generated documentation at all.
With same code sample, but without export keyword, generated documentation has default column and its values:
/**
* Test function.
* @param {string} [arg] - Test argument.
*/
function test(arg = 'default_value') {}
Your environment
| Software | Version |
|---|---|
| JSDoc | 4.0.0 |
| Node.js | 18.12.1 |
| npm | 8.12.2 |
| Operating system | Debian GNU/Linux bookworm/sid |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the exported function in test.js, using JSDoc 4.0.0 and the default configuration, then compare its generated documentation with the non-exported version. Trace where the default parameter metadata is lost; done means the exported function has a default column containing the expected value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100