import type { BaseQueryEnhancer } from './baseQueryTypes'; interface StaggerOptions { /** * How many times the query will be retried (default: 5) */ maxRetries?: number; /** * Function used to determine delay between retries */ backoff?: (attempt: number, maxRetries: number) => Promise; } declare function fail(e: any): never; /** * A utility that can wrap `baseQuery` in the API definition to provide retries with a basic exponential backoff. * * @example * * ```ts * // codeblock-meta title="Retry every request 5 times by default" * import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react' * interface Post { * id: number * name: string * } * type PostsResponse = Post[] * * // maxRetries: 5 is the default, and can be omitted. Shown for documentation purposes. * const staggeredBaseQuery = retry(fetchBaseQuery({ baseUrl: '/' }), { maxRetries: 5 }); * export const api = createApi({ * baseQuery: staggeredBaseQuery, * endpoints: (build) => ({ * getPosts: build.query({ * query: () => ({ url: 'posts' }), * }), * getPost: build.query({ * query: (id) => ({ url: `post/${id}` }), * extraOptions: { maxRetries: 8 }, // You can override the retry behavior on each endpoint * }), * }), * }); * * export const { useGetPostsQuery, useGetPostQuery } = api; * ``` */ export declare const retry: BaseQueryEnhancer & { fail: typeof fail; }; export {};