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

@typedef and @interface comments should not have parameter inference, possibly not any? #675

Open
batje opened this issue Feb 21, 2017 · 2 comments

Comments

@batje
Copy link
Contributor

batje commented Feb 21, 2017

When generating documentation of the jsdoc @typedef example, documentationjs adds 'x' as a parameter to the object NumberLike.

The way this seems to work is that the parameters of the function following the @typedef are added to the @typedef object. Moving the @typedef to the bottom of a file fixes the issue.

`/**

  • A number, or a string containing a number.
  • @typedef {(number|string)} NumberLike
    */

/**

  • Set the magic number.
  • @param {NumberLike} x - The magic number.
    */
    function setMagicNumber(x) {
    }
    `
@tmcw
Copy link
Member

tmcw commented Feb 23, 2017

Thanks for the report! This is the 'multi-signature' support getting out of hand, it's assuming that you want to document two variants of a function, and still doing inference. As a stopgap, you can use the @name tag to name the thing NumberLike and it'll turn off inference. But we should fix this in core, since it's definitely spooky behavior.

@tmcw tmcw changed the title @typedef objects get @params of following function @typedef and @interface comments should not have parameter inference, possibly not any? Jul 28, 2017
@tmcw
Copy link
Member

tmcw commented Jul 28, 2017

Q I have is: should interface and param comments get no inference? I think typedef should have properties inference. So far it's been all-inference-on-all-comments, but this is suggesting that it might be mix & match.

Or, well, I'm also open to removing the multi-signature support, which seems ambiguous in a way that will always be problematic.

cc @anandthakker @batje

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

No branches or pull requests

2 participants