-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
I'm using the "bailing out of error re-tries" example at https://redux-toolkit.js.org/rtk-query/usage/customizing-queries#bailing-out-of-error-re-tries with TypeScript and getting a message:
Exported variable 'staggeredBaseQueryWithBailOut' has or is using name 'StaggerOptions' from external module "[..]/@reduxjs/toolkit/dist/query/retry" but cannot be named.
Looking into the retry.d.ts definition and StaggerOptions is not exported, while temporarily adding export interface StaggerOptions resolves the message. I've made a workaround by redeclaring the module like
import { BaseQueryEnhancer } from '@reduxjs/toolkit/query/react'
declare module '@reduxjs/toolkit/query/react' {
export interface StaggerOptions {
maxRetries?: number
backoff?: (attempt: number, maxRetries: number) => Promise<void>
}
function fail(e: any): never
const retry: BaseQueryEnhancer<unknown, StaggerOptions, void | StaggerOptions> & {
fail: typeof fail
}
}
but it would be nice to have StaggerOptions exported so that it can be found by TS
jjl-genemod
Metadata
Metadata
Assignees
Labels
No labels