From 0dbb7fd4f61dc568498cd13a681fa7f907d6ec7e Mon Sep 17 00:00:00 2001 From: Aleksandar Dimitrov Date: Wed, 30 Jul 2025 20:38:36 +0200 Subject: [PATCH] fix(types): change the type guard on isCancel (#5595) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(types): change the type guard on isCancel … to `CanceledError`. 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 --------- Co-authored-by: Ehsan Samavati Co-authored-by: Jay --- index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index c2ed1956..aa27f335 100644 --- a/index.d.ts +++ b/index.d.ts @@ -443,6 +443,7 @@ export class AxiosError extends Error { } export class CanceledError extends AxiosError { + readonly name: "CanceledError"; } export type AxiosPromise = Promise>; @@ -543,7 +544,7 @@ export function isAxiosError(payload: any): payload is AxiosEr export function spread(callback: (...args: T[]) => R): (array: T[]) => R; -export function isCancel(value: any): value is Cancel; +export function isCancel(value: any): value is CanceledError; export function all(values: Array>): Promise;