Skip to content

Commit f5e299d

Browse files
committed
fix: Deprecate config.instance
1 parent 6e2454a commit f5e299d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface RetryConfig {
2727

2828
/**
2929
* The instance of the axios object to which the interceptor is attached.
30+
* @deprecated No longer needed.
3031
*/
3132
instance?: AxiosInstance;
3233

@@ -179,7 +180,7 @@ async function onError(instance: AxiosInstance, error: AxiosError) {
179180
config.retry = typeof config.retry === 'number' ? config.retry : 3;
180181
config.retryDelay =
181182
typeof config.retryDelay === 'number' ? config.retryDelay : 100;
182-
config.instance = config.instance || instance;
183+
instance = config.instance || instance;
183184
config.backoffType = config.backoffType || 'exponential';
184185
config.httpMethodsToRetry = normalizeArray(config.httpMethodsToRetry) || [
185186
'GET',
@@ -296,7 +297,7 @@ async function onError(instance: AxiosInstance, error: AxiosError) {
296297
return Promise.resolve()
297298
.then(async () => onBackoffPromise)
298299
.then(async () => onRetryAttemptPromise)
299-
.then(async () => config.instance!.request(axiosError.config!));
300+
.then(async () => instance.request(axiosError.config!));
300301
}
301302

302303
/**

0 commit comments

Comments
 (0)