Skip to content

Commit eb511b3

Browse files
committed
Make options for Agent.prototype.getName optional
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.
1 parent 536aaa5 commit eb511b3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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)