Skip to content

Commit

Permalink
Explicit type return on Promise
Browse files Browse the repository at this point in the history
TypeScript's automatic type resolution for the promise returned by the
function in getExponentialBackoffResponseHandler determines that it
returns a Promise<unknown>. This commit forces TypeScript to recognize
that the resolved object is of type Promise<AxiosResponse>.
  • Loading branch information
kitu-apietila committed Nov 1, 2023
1 parent 3cea4eb commit 64ce476
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/base/RequestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function getExponentialBackoffResponseHandler(
);
const delay = Math.floor(baseDelay * Math.random()); // Full jitter backoff

return new Promise((resolve) => {
return new Promise((resolve: (value: Promise<AxiosResponse>) => void) => {
setTimeout(() => resolve(axios(config)), delay);
});
}
Expand Down

0 comments on commit 64ce476

Please sign in to comment.