import { type Fetch, type FetchContext } from './fetch.js'; type LogFn = (...args: Args) => void | PromiseLike; export declare function loggedFetch({ fetch, logRequest, logResponse, logError, }: { fetch?: Fetch | undefined; logError?: boolean | LogFn<[error: unknown, request: Request]> | undefined; logRequest?: boolean | LogFn<[request: Request]> | undefined; logResponse?: boolean | LogFn<[response: Response, request: Request]> | undefined; }): Fetch; export declare const timedFetch: (timeout?: number, fetch?: Fetch) => Fetch; /** * Wraps a fetch function to bind it to a specific context, and wrap any thrown * errors into a FetchRequestError. * * @example * * ```ts * class MyClient { * constructor(private fetch = globalThis.fetch) {} * * async get(url: string) { * // This will generate an error, because the context used is not a * // FetchContext (it's a MyClient instance). * return this.fetch(url) * } * } * ``` * * @example * * ```ts * class MyClient { * private fetch: Fetch * * constructor(fetch = globalThis.fetch) { * this.fetch = bindFetch(fetch) * } * * async get(url: string) { * return this.fetch(url) // no more error * } * } * ``` */ export declare function bindFetch(fetch?: Fetch, context?: C): ((this: unknown, input: string | Request | URL, init?: RequestInit | undefined) => Promise) & { bind(context: unknown): (input: string | Request | URL, init?: RequestInit | undefined) => Promise; }; export {}; //# sourceMappingURL=fetch-wrap.d.ts.map