jsdoc / jsdoc/jsdoc

No automatic default values for arguments in functions exported from ES2015 module.

Open
#2,023 2 comments 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.