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

Discrepancy in JSDoc and implementation in express.Router(), parameter required by documentation is actually optional #3598

Closed
pubmikeb opened this issue Mar 20, 2018 · 3 comments

Comments

@pubmikeb
Copy link

At the very beginning of my router (Express.js) there are the following lines of code:

"use strict";

let express = require('express');
let router = express.Router();

IntelliJ IDEA returns warning Invalid number of arguments regarding let router = express.Router();.
I checked the official documentation of Express.js (see express.Router), and there is the same line of code.

The IntelliJ IDEA response:

JSDoc defines special syntax for documenting which parameters are optional and IDEA respects this syntax.

The function in express.js is documented here as having a non-optional parameter, while the implementation makes it optional.

Please, have a look if there is a need to synchronize the documentation and implementation.

Details:
https://youtrack.jetbrains.com/issue/WEB-31658

@pubmikeb pubmikeb changed the title Discrepancy in JSDoc and implementation in express.Router(), required parameter is actually optional Discrepancy in JSDoc and implementation in express.Router(), parameter required by documentation is actually optional Mar 20, 2018
@LinusU
Copy link
Member

LinusU commented Mar 20, 2018

Good catch 👍

PR is up here: #3599

@pubmikeb
Copy link
Author

So, was it the problem with documentation or implementation?

@LinusU
Copy link
Member

LinusU commented Mar 20, 2018

It was a problem with the JSDoc annotations, the options argument wasn't marked as optional, even though the object is indeed optional.

dougwilson pushed a commit that referenced this issue Sep 13, 2018
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