Skip to content

Conversation

@dgp1130
Copy link
Contributor

@dgp1130 dgp1130 commented Jun 30, 2025

In @types/[email protected], getName was added (DefinitelyTyped/DefinitelyTyped@239534a) with an optional argument, meaning Agent is not assignable to the @types/node declaration. This makes the options object optional and removes the unnecessary options.secureEndpoint check since this.isSecureEndpoint already handles it.

From history of Agent.prototype.getName in Node documentation:

v17.7.0, v16.15.0 | The options parameter is now optional.

Based on that line, I think the @types/node interpretation is accurate and this Agent implementation should assume the parameter may not be provided.

I do see several explicit any and @ts-expect-error related to the fact that getName was not included in @types/node. Now that it is, it might be worth bumping this depending and resolving those typing issues, but that seems more involved so I decided to keep this PR narrowly scoped for now.

I'm not 100% there aren't any more typing errors, but this is the only one I encountered when bumping @types/node.

@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2025

🦋 Changeset detected

Latest commit: 47817e0

The changes in this PR will be included in the next version bump.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
proxy-agents ✅ Ready (Inspect) Visit Preview Jun 30, 2025 5:12pm

In `@types/[email protected]`, `getName` was added with an optional argument, meaning `Agent` is not assignable to the `@types/node` declaration. This makes the `options` object optional and removes the unnecessary `options.secureEndpoint` check since `this.isSecureEndpoint` already handles it.
@jkoenig134
Copy link

@TooTallNate this looks solid. Could you merge and release it?

@TooTallNate TooTallNate merged commit a6fe3fd into TooTallNate:main Jul 7, 2025
14 checks passed
@TooTallNate
Copy link
Owner

Thanks!

@dgp1130 dgp1130 deleted the get-name-options branch July 7, 2025 16:33
@jkoenig134
Copy link

@TooTallNate this helps, but some of my dependencies are pinning an old version of https-proxy-agent which is pinning agent-base to 6. Could you backport this fix to agent-base 6?

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.

3 participants