import type { Ref } from './types/outputs/Ref.js'; export interface FetchOpts extends Omit { /** * Called before calling `fetch`, for logging purposes. * * @since 1.0.0 */ readonly onFetch?: (url: string | URL) => void; /** * Called on a successful fetch (with a status between 200 and 299) * Allows to parse the received response. * * @since 1.0.0 */ readonly onSuccess?: (res: Response) => PromiseLike; } /** * Wraps a fetch call into an asynchronous Ref. Calls are deduplicated, meaning that if "defer" is called while a * previous first `fetch` call is still running, "defer" will not call `fetch` again but rather will "subscribe" to the * running call. * * @param url url to be fetched * @param opts options given to fetch. * @throws FetchError when the fetch call fails (received a response with a status > 200) * * @since 1.0.0 * @see ref$ */ export declare function fetch$(url: string | URL, opts: FetchOpts & { onSuccess(res: Response): PromiseLike; }): Ref>; export declare function fetch$(url: string | URL, opts?: FetchOpts): Ref>; /** * Error emitted on an unsuccessful fetch (with a status > 200) * * @since 1.0.0 */ export declare class FetchError extends Error { readonly response: Response; constructor(response: Response); get status(): number; }