Fix definition of "listen" of net$Server and its subclasses #8290
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
listen
signature ofnet$Server
did not match the definition ofthe actual API at https://nodejs.org/api/net.html#net_server_listen
In particular, flow failed to detect invalid handles and options due to
the use of an object with all-optional properties, and the use of
Function
(which is an alias forany
).This patch fixes the following issues:
net$Server
from its subclasses, and add missinglisten
methods tonet$Server
.Function
(which is equivalent toany
), but() => mixed
.listen
'shandle
parameter tooptions
.options
object to either containpath
orport
.listen
method with parameterhandle
has a type definition.Fixed the following issues with
node_tests
:node_tests
that were marked with "These should fail" are now failing as expected.handle
renamed tooptions
.fd
renamed topath
(string values arepath
, notfd
).listen(handle, ...)
.The number of expected
node_tests
failures increased from 115 to 131.12 of those are tests that were marked as "failing" but did not.
The other 4 are signatures that were marked as "passing" but should have
failed (
fd
with string value instead of number, and empty object).