export type FetcherRequestType = 'text' | 'json' | 'arrayBuffer'; export type FetcherResponseDataByTypeMap = { text: string; json: unknown; arrayBuffer: ArrayBuffer; }; export type FetcherOptions = { method?: string; responseType: T; headers?: Record; body?: string | Blob | BufferSource | null; /** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */ referrer?: string; /** An AbortSignal to set request's signal. */ signal?: AbortSignal | null; }; export interface FetcherResponse { readonly headers: Map; readonly ok: boolean; readonly status: number; readonly statusText: string; readonly data: D; } export type Fetcher = (url: string, options: FetcherOptions) => Promise>;