wretch
Version:
A tiny wrapper built around fetch with an intuitive syntax.
25 lines (24 loc) • 899 B
TypeScript
import { WretchError } from "./resolver.js";
import type { Wretch, WretchOptions } from "./types.js";
export type { Wretch, ConfiguredMiddleware, FetchLike, Middleware, WretchResponseChain, WretchOptions, WretchError, WretchErrorCallback, WretchResponse, WretchDeferredCallback, WretchAddon } from "./types.js";
/**
* Creates a new wretch instance with a base url and base
* [fetch options](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch).
*
* ```ts
* import wretch from "wretch"
*
* // Reusable instance
* const w = wretch("https://domain.com", { mode: "cors" })
* ```
*
* @param _url The base url
* @param _options The base fetch options
* @returns A fresh wretch instance
*/
declare const factory: {
(_url?: string, _options?: WretchOptions): Wretch;
default: /*elided*/ any;
WretchError: typeof WretchError;
};
export default factory;