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

fix(types): make parseReviver context.source optional per ES2023 spec (#10837)

Per the TC39 proposal-json-parse-with-source, context.source is only
set when the reviver is invoked on a primitive value (string, number,
boolean, null). For object/array values, source is absent from the
context object.

Changed context?: { source: string } to context?: { source?: string }
in both index.d.ts and index.d.cts.

Fixes #10817

Co-authored-by: Maks Pikov <mixelburg@users.noreply.github.com>
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
mixelburg
2026-05-06 18:38:36 +03:00
committed by GitHub
parent 23fd0a6a16
commit ac5c335b3b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -544,7 +544,7 @@ declare namespace axios {
| LookupAddress
>);
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
parseReviver?: (this: any, key: string, value: any, context?: { source: string }) => any;
parseReviver?: (this: any, key: string, value: any, context?: { source?: string }) => any;
fetchOptions?:
| Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
| Record<string, any>;
Vendored
+1 -1
View File
@@ -441,7 +441,7 @@ export interface AxiosRequestConfig<D = any> {
[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress
>);
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
parseReviver?: (this: any, key: string, value: any, context?: { source: string }) => any;
parseReviver?: (this: any, key: string, value: any, context?: { source?: string }) => any;
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
httpVersion?: 1 | 2;
http2Options?: Record<string, any> & {