2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

fix(types): align cjs cancelToken types (#7414)

the import/esm types include `undefined` (ref:
https://github.com/axios/axios/blob/v1.x/index.d.ts#L457)

this was added recently in #5560 - but only to `index.d.ts`,
which can break type-checking in projects using a mixture
of cjs and esm, when `exactOptionalPropertyTypes` is enabled,
as it makes the request config types incompatible with eachother.

you can see an example of the type error / this patch resolving
it on https://github.com/mnahkies/openapi-code-generator/pull/427

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Michael Nahkies
2026-04-26 11:52:10 +01:00
committed by GitHub
parent c918e85e91
commit b072ee8e0c
+1 -1
View File
@@ -503,7 +503,7 @@ declare namespace axios {
httpAgent?: any;
httpsAgent?: any;
proxy?: AxiosProxyConfig | false;
cancelToken?: CancelToken;
cancelToken?: CancelToken | undefined;
decompress?: boolean;
transitional?: TransitionalOptions;
signal?: GenericAbortSignal;