Added the definition of the "axios-cancel" package

This commit is contained in:
TheDSCPL 2019-04-10 18:13:55 +01:00 committed by Luis
parent db82e27b78
commit 7f1710ce85
2 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
// can't test because it depends on axios which makes Travis CI be unable to compile with the error "expect TypeScript@next compile error: Cannot find module 'axios'."
import axios, { AxiosPromise } from "axios"
import axiosCancel, { AxiosStatic } from "axios-cancel";
import axios, { AxiosPromise } from "axios";
import axiosCancel from "axios-cancel";
axiosCancel(axios); // $ExpectType void
@ -9,7 +9,7 @@ axios.get(
'https://jsonplaceholder.typicode.com/users', {
requestId: "test id"
}
); // $ExpectType AxiosPromise<any>
); // $ExpectType Promise<any>
axios.cancel("test id"); // $ExpectType void

View File

@ -4,13 +4,13 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
import {AxiosStatic} from "axios";
import { AxiosStatic } from "axios";
declare module 'axios' {
export interface AxiosRequestConfig {
interface AxiosRequestConfig {
requestId?: string;
}
export interface AxiosStatic {
interface AxiosStatic {
cancel: (requestId: string) => void;
cancelAll: () => void;
}