Skip to content
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

@param for varargs #35

Closed
cowwoc opened this issue Nov 6, 2014 · 3 comments · Fixed by #47
Closed

@param for varargs #35

cowwoc opened this issue Nov 6, 2014 · 3 comments · Fixed by #47
Labels
Milestone

Comments

@cowwoc
Copy link

cowwoc commented Nov 6, 2014

Given:

/**
 * Returns the sum of all numbers passed to the function.
 * @param {...number} num - A positive or negative number.
 */
function sum(num) {
    var i = 0, n = arguments.length, t = 0;
    for (; i < n; i++) {
        t += arguments[i];
    }
    return t;
}

from http://usejsdoc.org/tags-param.html you will get "Invalid JsDoc type definition" for the @param. It looks like the varargs syntax is not recognized.

@qfox qfox added the bug label Nov 6, 2014
@qfox qfox added this to the v0.1.0 milestone Nov 10, 2014
@qfox qfox closed this as completed in #47 Nov 11, 2014
@yelworc
Copy link

yelworc commented Nov 30, 2014

Shouldn't this also allow something like this:

/**
 * ...
 * @param {function} callback function to call after the delay
 * @param {number} delay delay in ms
 * @param {...*} args arbitrary arguments for the callback function
 */
setTimeout(callback, delay)

At the moment, this results in a "jsDoc: redundant param statement" error.
FWIW, jsdoc does render this nicely.

@qfox
Copy link
Member

qfox commented Nov 30, 2014

@yelworc I think you're right. If type or name contains ... it should be qualified as optional. You can wrap args to brackets for now.

I've made an issue about it.

@qfox
Copy link
Member

qfox commented Nov 30, 2014

@yelworc Thanks for report ;-)

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

Successfully merging a pull request may close this issue.

3 participants