Skip to content

Feature: suppress parameter inference #896

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
rhendric opened this issue Sep 2, 2017 · 2 comments
Closed

Feature: suppress parameter inference #896

rhendric opened this issue Sep 2, 2017 · 2 comments

Comments

@rhendric
Copy link
Contributor

rhendric commented Sep 2, 2017

Let's say I want to document snorf:

const snorf = (...args) => innerSnorf(...args).toString();

In reality, snorf is meant to take three parameters, because that's what innerSnorf takes, and none of them are named args. Or maybe snorf is supposed to be used in a context where the fact that it's a function isn't important, like as a template literal tag. In these cases, I can't find a way to tell documentation to stop inferring that the documentation for snorf should include a parameter named args, short of changing the implementation of snorf to use arguments (which, in 2017, is way uncool).

Some ideas, in expected ascending order of complexity and flexibility:

  • An explicit @member, or other @kind not-a-function tag, could be a cue to skip inferring parameters?
  • Implement a custom tag @ignoreparameters?
  • A magic extension to @param, like @param {ignore} args or @param args - [ignore], for per-parameter suppression?

Discussion please! I would be happy to implement the proposal that is most popular.

@tmcw
Copy link
Member

tmcw commented Sep 2, 2017

Sure! The JSDoc standard way to do this, which documentation.js supports, is using @name snorf. The @name tag tells documentation.js to skip all inference, so the documentation about the function is only exactly what you write as documentation tags, not affected at all by the code context. There's a little bit about this in troubleshooting.

Whether it should be feasible to disable some inference and whether this admittedly not-obvious signal to turn it off is good enough... I'd certainly be interested in a more straightforward way to override or disable inference.

@rhendric
Copy link
Contributor Author

rhendric commented Sep 2, 2017

Well, that sounds good enough... am I doing this wrong, or is this a bug?

test.js

/**
 * @name snorf
 */
const snorf = (...args) => {};

documentation build test.js -f md

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [snorf](#snorf)

## snorf

**Parameters**

-   `args` **...any**

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