From db82e27b7841375b8960ac7dd1ce0964d62fdbce Mon Sep 17 00:00:00 2001 From: TheDSCPL Date: Wed, 10 Apr 2019 18:07:29 +0100 Subject: [PATCH] Added the definition of the "axios-cancel" package --- types/axios-cancel/axios-cancel-tests.ts | 8 ++------ types/axios-cancel/index.d.ts | 6 +++--- types/axios-cancel/package.json | 6 ++++++ 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 types/axios-cancel/package.json diff --git a/types/axios-cancel/axios-cancel-tests.ts b/types/axios-cancel/axios-cancel-tests.ts index c7aac46d28..698f46ed62 100644 --- a/types/axios-cancel/axios-cancel-tests.ts +++ b/types/axios-cancel/axios-cancel-tests.ts @@ -1,9 +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 from "axios-cancel"; +import axiosCancel, { AxiosStatic } from "axios-cancel"; axiosCancel(axios); // $ExpectType void @@ -11,10 +9,8 @@ axios.get( 'https://jsonplaceholder.typicode.com/users', { requestId: "test id" } -); // $ExpectType Promise +); // $ExpectType AxiosPromise axios.cancel("test id"); // $ExpectType void axios.cancelAll(); // $ExpectType void - -*/ \ No newline at end of file diff --git a/types/axios-cancel/index.d.ts b/types/axios-cancel/index.d.ts index deb400ed67..8bd81855a3 100644 --- a/types/axios-cancel/index.d.ts +++ b/types/axios-cancel/index.d.ts @@ -8,8 +8,8 @@ import {AxiosStatic} from "axios"; declare module 'axios' { export interface AxiosRequestConfig { - requestId?: string - }; + requestId?: string; + } export interface AxiosStatic { cancel: (requestId: string) => void; cancelAll: () => void; @@ -21,7 +21,7 @@ interface AxiosCancelOptions { * Enables logging * default: false */ - debug: boolean + debug: boolean; } declare function axiosCancel(axiosStatic: AxiosStatic, options?: AxiosCancelOptions): void; diff --git a/types/axios-cancel/package.json b/types/axios-cancel/package.json new file mode 100644 index 0000000000..3f66771e25 --- /dev/null +++ b/types/axios-cancel/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "axios": "0.15.2" + } +}