-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Service Bus] [Event Hubs] Updated https-proxy-agent #4187
Conversation
Version 2.2.2 was released with some TypeScript definitions! Time to update. Fixes Azure#3064
const url = require("url"); | ||
const httpsProxyAgent = require("https-proxy-agent"); | ||
import url from "url"; | ||
import httpsProxyAgent, { HttpsProxyAgentOptions } from "https-proxy-agent"; |
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.
shouldn't this be
import { HttpsProxyAgent, HttpsProxyAgentOptions } from "https-proxy-agent"
?
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.
It actually can't be neither import httpsProxyAgent from "https-proxy-agent";
or import { HttpsProxyAgent } from "https-proxy-agent";
. Seems like I need to add the current export as the default property of the exported value. I'll elaborate:
Right now, https-proxy-agent is exporting it's default method by just doing:
https://github.com/TooTallNate/node-https-proxy-agent/blob/master/index.js#L16
I'm guessing it has to be changed to something like:
module.exports = HttpsProxyAgent;
module.exports.default = module.exports;
Would that work? Seems risky.
I'll change these imports to use require
for now.
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.
In that I case, I would skip the import and use of HttpsProxyAgentOptions
altogether.
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.
The issue is that this code used to fail using tsc
🤔 that's why I opened #3064
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.
Its hard to believe that the lack of typing for the options
object was what caused tsc
to fail
It feels weird to import/require from the same module twice
Can't we do import httpsProxyAgent from "https-proxy-agent"
and then not use the type when defining options
?
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.
I'll give it a try again! I'll come back with updates
I'll close this PR since we haven't been able to get back to it for a long time. This is probably not relevant anymore. |
Version 2.2.2 was released with some TypeScript definitions! Time to
update.
Fixes #3064