import * as tough from 'tough-cookie'; interface GenericRequest { url: string; } interface URLLike { href: string; } declare type GenericRequestInfo = string | URLLike | GenericRequest; interface GenericRequestInit { method?: string; redirect?: string; body?: any; referrerPolicy?: string; } interface GenericResponse { url: string; status: number; headers: { get: (name: string) => string | null; has: (name: string) => boolean; }; } declare type FetchCookieInit = T & { maxRedirect?: number; redirectCount?: number; }; declare type GenericFetch = (input: T1, init?: T2) => Promise; interface FetchCookieImpl { (input: T1, init?: FetchCookieInit): Promise; toughCookie: typeof tough; } export interface CookieJar { getCookieString: (currentUrl: string) => Promise; setCookie: (cookieString: string, currentUrl: string, opts: { ignoreError: boolean; }) => Promise; } declare function fetchCookie(fetch: GenericFetch, jar?: CookieJar, ignoreError?: boolean): FetchCookieImpl; declare namespace fetchCookie { var toughCookie: typeof tough; } export = fetchCookie;