-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
lib/node.js: 'https' interfaces should use tls$TLSSocket instead of net$Socket #7215
Conversation
At a glance, this looks reasonable. Could you link API docs that support this change? |
It's not spelled out explicitly, but:
|
Okay, that's good enough for me. Could you also do a quick sanity check that things behave, at runtime, the way your new Flow types claim? I'm not asking for anything really in-depth, maybe just a short Could you also update the classes for which you have added type parameters to have After that, I'll import and assuming that the rollout burden doesn't look too bad on our main repositories, I'll merge. Thanks for the PR! |
Example of using
|
Added the (Too bad we can't write |
7f7b659
to
d0daeac
Compare
Yeah, I'm not sure what went into the decision to require the Anyway, I'll import this, see how involved the rollout would be, and get back to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nmote has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Oh, that makes sense. Java did something similar when to aid the transition to generics in 1.5. |
I think we're good here. My only concern was that anybody who references these types would have to add the I'll make sure it gets mentioned specifically in the release notes when it goes out. I just need to get someone to approve this internally and then I'll land it. Thanks for the contribution! |
Summary: Followup to D13868636 / #7215 We found a place where someone wanted to use an `http$Agent` from either the `http` module or the `https` module, depending on some runtime flag. Unfortunately, the original change made it so that `http$Agent<net$Socket>` did not have a subtype relationship with `http$Agent<tls$TLSSocket>`. This change makes it so that `http$Agent<tls$TLSSocket>` is a subtype of `http$Agent<net$Socket>`. I believe that the readonlyness that I added in several places matches the spirit of the API. Reviewed By: dsainati1 Differential Revision: D14107704 fbshipit-source-id: e2347d6d8c8315a0f263ab6268023c1524475b10
FYI I made some tweaks since this PR ended up causing us some rollout pain internally. The specific issue and the fix are in the commit message: 6a4c5a0 This change will go out with v0.94.0. In the meantime we are just going to suppress the errors. |
The issue:
Before, Flow would flag both with the message: Cannot call
res.socket.getPeerCertificate
because propertygetPeerCertificate
is missing innet$Socket
[1].After this change, Flow only flags the first.
My fix adds a
SocketT
type parameter to a few base classes. Not sure if that's the best way to do it.