From ac5c335b3b4bf00c024d8b6ede37fcbd7ebb7051 Mon Sep 17 00:00:00 2001 From: mixelburg <52622705+mixelburg@users.noreply.github.com> Date: Wed, 6 May 2026 18:38:36 +0300 Subject: [PATCH] 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 Co-authored-by: Jay --- index.d.cts | 2 +- index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.cts b/index.d.cts index 918e4821..916b9958 100644 --- a/index.d.cts +++ b/index.d.cts @@ -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 | Record; diff --git a/index.d.ts b/index.d.ts index fea8b7f4..e25555fa 100644 --- a/index.d.ts +++ b/index.d.ts @@ -441,7 +441,7 @@ export interface AxiosRequestConfig { [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 | Record; httpVersion?: 1 | 2; http2Options?: Record & {