mirror of
https://github.com/axios/axios.git
synced 2026-04-11 14:21:59 +08:00
fix(types): change the type guard on isCancel (#5595)
* fix(types): change the type guard on isCancel
… to `CanceledError<any>`. This makes more sense as it reflects what
`isCancel` is actually doing. In fact, if I'm not mistaken, the
`Cancel` type is no longer in the project. It got removed in
7f12366. It should probably also be removed from the types.
* Parameterize `CanceledError` in `isCancel`
Thanks to @samavati for the suggestion.
Co-authored-by: Ehsan Samavati <samaavaati@gmail.com>
---------
Co-authored-by: Ehsan Samavati <samaavaati@gmail.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
parent
5a079ca394
commit
0dbb7fd4f6
3
index.d.ts
vendored
3
index.d.ts
vendored
@ -443,6 +443,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
|
||||
}
|
||||
|
||||
export class CanceledError<T> extends AxiosError<T> {
|
||||
readonly name: "CanceledError";
|
||||
}
|
||||
|
||||
export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
||||
@ -543,7 +544,7 @@ export function isAxiosError<T = any, D = any>(payload: any): payload is AxiosEr
|
||||
|
||||
export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
||||
|
||||
export function isCancel(value: any): value is Cancel;
|
||||
export function isCancel<T = any>(value: any): value is CanceledError<T>;
|
||||
|
||||
export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user