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:
Aleksandar Dimitrov 2025-07-30 20:38:36 +02:00 committed by GitHub
parent 5a079ca394
commit 0dbb7fd4f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

3
index.d.ts vendored
View File

@ -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[]>;