TooTallNate/proxy-agents

node-fetch: Property 'freeSockets' is missing in type 'HttpsProxyAgent' but required in type 'Agent'.

Closed this issue · 5 comments

plugins/slack/src/index.ts:178:7 - error TS2322: Type 'HttpsProxyAgent | undefined' is not assignable to type 'Agent | ((parsedUrl: URL) => Agent) | undefined'.
  Type 'HttpsProxyAgent' is not assignable to type 'Agent | ((parsedUrl: URL) => Agent) | undefined'.
    Property 'freeSockets' is missing in type 'HttpsProxyAgent' but required in type 'Agent'.

178       agent: proxyUrl ? createHttpsProxyAgent(proxyUrl) : undefined,
          ~~~~~

  node_modules/@types/node/http.d.ts:362:18
    362         readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
                         ~~~~~~~~~~~
    'freeSockets' is declared here.

This issue is blocking the merge of intuit/auto#1317

Any workaround for now?

I had this as well. The solution was to downgrade @types/node to a 12.x.y version.

Workaround would be to pass the agent as any

agent-base now extends directly from Node's http.Agent, so this should be fixed as of the latest release.