-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
- Version: v4-v8
- Platform: macOS 10.12.6
- Subsystem: http, net
This is in relation to facebook/flow#1684
While Flow typing a module that uses http.Server.listen(), I received an error for the idiomatic form widely used in Node projects:
const server = http.createServer();
server.listen(8080, function listening() {});
Flow declares the types of http.Server.listen() like this:
declare module "http" {
declare class Server extends net$Server {
listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
listen(path: string, callback?: Function): Server;
listen(handle: Object, callback?: Function): Server;
which adheres to the documentation of the http module.
Since the net module normalizes the arguments and Node itself uses the shorthand forms in the docs on the same page (Event: 'connect', Event: 'upgrade'), I suggest to amend the documentation explaining the shorthand forms are both supported:
listen(port, callback)
listen(port, hostname, callback)
Thoughts?
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.