diff --git a/@types/index.d.ts b/@types/index.d.ts index c0e78bc..1e36d66 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts @@ -1,7 +1,7 @@ /// /// -import {Agent} from 'http'; +import {RequestOptions} from 'http'; import { Blob, blobFrom, @@ -98,7 +98,7 @@ export interface RequestInit { referrerPolicy?: ReferrerPolicy; // Node-fetch extensions to the whatwg/fetch spec - agent?: Agent | ((parsedUrl: URL) => Agent); + agent?: RequestOptions['agent'] | ((parsedUrl: URL) => RequestOptions['agent']); compress?: boolean; counter?: number; follow?: number; diff --git a/@types/index.test-d.ts b/@types/index.test-d.ts index 4b24dcb..6277665 100644 --- a/@types/index.test-d.ts +++ b/@types/index.test-d.ts @@ -78,6 +78,8 @@ async function run() { expectAssignable(request); /* eslint-disable no-new */ + new Request('url', {agent: false}); + new Headers({Header: 'value'}); // new Headers(['header', 'value']); // should not work new Headers([['header', 'value']]);