mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +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:
+1
-1
@@ -544,7 +544,7 @@ declare namespace axios {
|
|||||||
| LookupAddress
|
| LookupAddress
|
||||||
>);
|
>);
|
||||||
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
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?:
|
fetchOptions?:
|
||||||
| Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
|
| Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
|
||||||
| Record<string, any>;
|
| Record<string, any>;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -441,7 +441,7 @@ export interface AxiosRequestConfig<D = any> {
|
|||||||
[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress
|
[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress
|
||||||
>);
|
>);
|
||||||
withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
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>;
|
fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;
|
||||||
httpVersion?: 1 | 2;
|
httpVersion?: 1 | 2;
|
||||||
http2Options?: Record<string, any> & {
|
http2Options?: Record<string, any> & {
|
||||||
|
|||||||
Reference in New Issue
Block a user