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

BalancedPool types don't account for all upstreams variations #1948

Closed
jimmy-guzman opened this issue Feb 21, 2023 · 2 comments · Fixed by #1966
Closed

BalancedPool types don't account for all upstreams variations #1948

jimmy-guzman opened this issue Feb 21, 2023 · 2 comments · Fixed by #1966
Labels
bug Something isn't working Types Changes related to the TypeScript definitions

Comments

@jimmy-guzman
Copy link
Contributor

Bug Description

Unless I'm missing something but shouldn't the types for BalancedPool, allow for URL[]. Based on the types it seems like it doesn't but then the implementation seems like it should/can.

Also, should addUpstream allow URL?

Ignoring TypeScript errors, everything seems to work as expected

Reproducible By

const pool = new BalancedPool([new URL("https://github.com/")]);
// Type 'URL' is not assignable to type 'string'.ts(2322)

pool.addUpstream(new URL("https://github.com/"));
// Argument of type 'URL' is not assignable to parameter of type 'string'.ts(2345)

Expected Behavior

The following should not cause typescript errors

const pool = new BalancedPool([new URL("https://github.com/")])
pool.addUpstream(new URL("https://github.com/"));

Logs & Screenshots

Environment

TypeScript: 4.9.5
Node: v18.12.1

@jimmy-guzman jimmy-guzman added the bug Something isn't working label Feb 21, 2023
@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests, we use tsd for typescript.

@mcollina mcollina added the Types Changes related to the TypeScript definitions label Feb 21, 2023
@jimmy-guzman
Copy link
Contributor Author

@mcollina Thanks for the quick reply. I'll make a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Types Changes related to the TypeScript definitions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants