mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added the definition of the "axios-cancel" package
This commit is contained in:
parent
3fc334203e
commit
61cb4635e6
@ -1,5 +1,5 @@
|
||||
import axios, {AxiosPromise} from "axios"
|
||||
import axiosCancel from "axios-cacel";
|
||||
import axios, { AxiosPromise } from "axios"
|
||||
import axiosCancel from "axios-cancel";
|
||||
|
||||
axiosCancel(axios);
|
||||
|
||||
@ -7,4 +7,6 @@ axios.get(
|
||||
'https://jsonplaceholder.typicode.com/users', {
|
||||
requestId: "test id"
|
||||
}
|
||||
) // $ExpectType AxiosPromise<any>
|
||||
); // $ExpectType Promise<any>
|
||||
|
||||
axios.cancel("test id");
|
||||
|
||||
13
types/axios-cancel/index.d.ts
vendored
13
types/axios-cancel/index.d.ts
vendored
@ -4,12 +4,17 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import axios from "axios";
|
||||
import {AxiosStatic} from "axios";
|
||||
|
||||
declare module 'axios' {
|
||||
export interface AxiosRequestConfig {
|
||||
requestId?: string
|
||||
};
|
||||
requestId?: string;
|
||||
}
|
||||
export interface AxiosStatic {
|
||||
cancel: (requestId: string) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export =function (a: typeof axios): void;
|
||||
declare function axiosCancel(a: AxiosStatic): void;
|
||||
|
||||
export default axiosCancel;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user