diff --git a/src/axios.ts b/src/axios.ts index 5eed910..b9cf63c 100644 --- a/src/axios.ts +++ b/src/axios.ts @@ -1,10 +1,14 @@ import Axios, {AxiosError, AxiosRequestConfig} from "axios"; import {S5Error} from "#client.js"; +export interface CancelablePromise extends Promise { + cancel: () => void; +} + export const customInstance = ( config: AxiosRequestConfig, options?: AxiosRequestConfig, -): Promise => { +): CancelablePromise => { const source = Axios.CancelToken.source(); /* @@ -33,5 +37,5 @@ export const customInstance = ( source.cancel("Query was cancelled"); }; - return promise; + return promise as CancelablePromise; };