Skip to content

Commit a6fe3fd

Browse files
authored
Make options for Agent.prototype.getName optional (#378)
1 parent 536aaa5 commit a6fe3fd

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

.changeset/short-spiders-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'agent-base': patch
3+
---
4+
5+
Fix compatibility with `@types/node@20.19.2`.

packages/agent-base/src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,8 @@ export abstract class Agent extends http.Agent {
124124

125125
// In order to properly update the socket pool, we need to call `getName()` on
126126
// the core `https.Agent` if it is a secureEndpoint.
127-
getName(options: AgentConnectOpts): string {
128-
const secureEndpoint =
129-
typeof options.secureEndpoint === 'boolean'
130-
? options.secureEndpoint
131-
: this.isSecureEndpoint(options);
127+
getName(options?: AgentConnectOpts): string {
128+
const secureEndpoint = this.isSecureEndpoint(options);
132129
if (secureEndpoint) {
133130
// @ts-expect-error `getName()` isn't defined in `@types/node`
134131
return HttpsAgent.prototype.getName.call(this, options);

0 commit comments

Comments
 (0)