Skip to content

Default param values should be retained with @param #1229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
devongovett opened this issue Apr 14, 2019 · 0 comments · Fixed by #1230
Closed

Default param values should be retained with @param #1229

devongovett opened this issue Apr 14, 2019 · 0 comments · Fixed by #1230

Comments

@devongovett
Copy link
Contributor

When using default parameters in JS/Flow, but using @param to provide param descriptions, the default value is lost.

// @flow
/**
 * @param bar This is the bar parameter
 */
function foo(bar: string = 'foo') {
  
}

This can be "fixed" by repeating the default as part of the JSDoc comment.

// @flow
/**
 * @param [bar='foo'] This is the bar parameter
 */
function foo(bar: string = 'foo') {
  
}

This is annoying however. It would be nice if the default value inferred from the function declaration could be merged with the description provided by JSDoc. Alternatively, if there were a way to provide only the description to @param and not the name, that would work too, but this doesn't seem possible in the JSDoc spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant