Skip to content
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

Corrected TypeScript type definitions so that both HTTP and HTTPS servers are supported #18

Merged
merged 1 commit into from Jan 10, 2020

Conversation

jan-molak
Copy link
Contributor

Hey @thedillonb and thanks for your work on http-shutdown!

I use it as part of the Serenity/JS project to allow people to manage local test servers.

I noticed that the change introduced in version 1.2.1 breaks backwards compatibility and prevents TypeScript code from passing a HTTPs server to http-shutdown.

In order to address that issue, the type of the Server object needs to be changed from http.Server to net.Server.

That's because in the inheritance chain, the net.Server type is the first common element:

  • HTTPs server: https.Server -> tls.Server -> net.Server -> events.EventEmitter
  • HTTP server: http.Server -> net.Server -> events.EventEmitter

Please let me know if your happy with this PR or if you'd like me to provide any additional details!

I've tested http-shutdown to death in the context of Serenity/JS, so am fairly confident that the only issue that needs addressing is the type definitions :-)

All the best,
Jan

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.946% when pulling f793008 on jan-molak:master into fec8ee6 on thedillonb:master.

@jan-molak
Copy link
Contributor Author

Thanks for approving the PR, @alexmnyc, much appreciated!

Could you please advise when the change might get released to npm?

@thedillonb thedillonb merged commit 4dcc75f into thedillonb:master Jan 10, 2020
@thedillonb
Copy link
Owner

@jan-molak outstanding work and great catch. I will publish right now.

@thedillonb
Copy link
Owner

All set @jan-molak , it's up on NPM. Thanks again

jan-molak added a commit to serenity-js/serenity-js that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants