As in the following example, I am defining the return type of createServer() to be a MockServer interface (which is empty), instead of "Server" as defined in https://github.com/facebook/flow/blob/master/lib/node.js
Shouldn't this work, since an empty interface can stand in for any class?
/* @flow */
var http = require("http");
interface MockServer {}
type HttpModule = {
createServer: (listener?: Function) => MockServer
}
function test(mod: HttpModule) {
var p = mod.createServer();
}
test(http);
The result of "flow check" is:
test.js:7
7: createServer: (listener?: Function) => MockServer
^^^^^^^^^^ MockServer. This type is incompatible with
689: declare function createServer(listener?: Function): Server;
^^^^^^ Server. See: /tmp/flow/flowl