- 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?
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:Flow declares the types of
http.Server.listen()like this:which adheres to the documentation of the
httpmodule.Since the
netmodule 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:Thoughts?