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

Improve JSDoc typings for optional parameters #732

Open
daniellockyer opened this issue May 17, 2023 · 0 comments
Open

Improve JSDoc typings for optional parameters #732

daniellockyer opened this issue May 17, 2023 · 0 comments

Comments

@daniellockyer
Copy link

Hi! Love dockerode 😀

One thing I've noticed is that the JSDoc types for parameters which are optional aren't marked as so, so my editor tends to complain when I use dockerode with no params and Promises. Optional parameters in JSDoc are indicated with square brackets.

For example, container.inspect allows for optional opts and callback:

/**
* Inspect
* @param {Object} opts Options (optional)
* @param {Function} callback Callback, if supplied will query Docker.
* @return {Object} ID only and only if callback isn't supplied.
*/

CleanShot 2023-05-17 at 10 25 04@2x

In this example, the parameter types should be:

* @param  {Object}   [opts]     Options
* @param  {Function} [callback] Callback
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

1 participant