Skip to content

Commit 18a5695

Browse files
committed
Suppress legacy axios dependencies TypeScript issues
1 parent 59eb0f7 commit 18a5695

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/helper/createAxiosInstance.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import axios from "axios";
1+
import axios, { type AxiosStatic } from "axios";
22
import rateLimit, {
33
type RateLimitedAxiosInstance,
44
type rateLimitOptions as RateLimitOptions,
@@ -36,11 +36,17 @@ export default function createAxiosInstance(): RateLimitedAxiosInstance {
3636
maxRPS: 2,
3737
};
3838

39-
const axiosClient = axios.create();
39+
// @FIXME: Legacy version of axios does not play well with verbatim types
40+
const axiosClient = (axios as unknown as AxiosStatic).create();
4041

4142
axiosClient.defaults.headers.common["User-Agent"] =
4243
"React Native Version Tracker";
4344

4445
axiosRetry(axiosClient, axiosRetryConfig);
45-
return rateLimit(axiosClient, axiosRateLimitOptions);
46+
47+
// @FIXME: Legacy version of axios-rate-limit does not play well with verbatim types
48+
return (rateLimit as unknown as typeof import("axios-rate-limit").default)(
49+
axiosClient,
50+
axiosRateLimitOptions
51+
);
4652
}

0 commit comments

Comments
 (0)