var factory.options: (options: object, replace?: boolean) => void
wretch
wretch(_url?: string, _options?: {}): Wretch
I had a quik look in the code, and appearently WretchOptions in is not defined either, its just Record<string, any>.
Since I have little time I asked ChatGPT if he knew what all available types were.
Without veryifing it myself it gave me this:
type WretchOptions = {
baseUrl?: string; // Base URL for requests
headers?: Record<string, string>; // Default headers for requests
credentials?: 'omit' | 'same-origin' | 'include'; // CORS credentials mode
mode?: 'cors' | 'no-cors' | 'same-origin'; // Request mode
redirect?: 'follow' | 'error' | 'manual'; // Redirect behavior
timeout?: number; // Timeout for requests in milliseconds
signal?: AbortSignal; // AbortSignal to cancel requests
retry?: {
limit?: number; // Maximum number of retry attempts
delay?: number; // Delay between retries in milliseconds
} | number; // Can also be just a number for retry limit
throwOnError?: boolean; // Whether to throw on HTTP errors
body?: string | object | FormData | URLSearchParams | ReadableStream; // Default body
type?: 'application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data'; // Content type
};
Yes the options argument is loosely typed on purpose to be able to pass various properties depending on the underlying fetch implementation (or to store arbitrary data).
The type for options is
object
wretch.options
wretch
I had a quik look in the code, and appearently
WretchOptions
in is not defined either, its justRecord<string, any>
. Since I have little time I asked ChatGPT if he knew what all available types were.Without veryifing it myself it gave me this: