diff --git a/.gitignore b/.gitignore index 72b7583..ccc5357 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ node_modules/ dist/ esm/ lib/ +yarn.lock diff --git a/src/throttleAdapterEnhancer.ts b/src/throttleAdapterEnhancer.ts index 48ca435..66396e4 100644 --- a/src/throttleAdapterEnhancer.ts +++ b/src/throttleAdapterEnhancer.ts @@ -4,7 +4,7 @@ * @since 2017-10-11 */ -import { AxiosAdapter, AxiosPromise, AxiosRequestConfig } from 'axios'; +import { AxiosAdapter, AxiosPromise, InternalAxiosRequestConfig } from 'axios'; import LRUCache from 'lru-cache'; import buildSortedURL from './utils/buildSortedURL'; import { ICacheLike } from './utils/isCacheLike'; @@ -21,14 +21,13 @@ export type Options = { export default function throttleAdapterEnhancer(adapter: AxiosAdapter, options: Options = {}): AxiosAdapter { - const { threshold = 1000, cache = new LRUCache({ max: 10 }) } = options; + const { threshold = 1000, cache = new LRUCache({ max: 10 }) } = options; - const recordCacheWithRequest = (index: string, config: AxiosRequestConfig) => { + const recordCacheWithRequest = (index: string, config: InternalAxiosRequestConfig) => { const responsePromise = (async () => { try { - // @ts-ignore const response = await adapter(config); cache.set(index, {