diff --git a/.api-reports/api-report-core.md b/.api-reports/api-report-core.md index b405231b1df..d73743d3a81 100644 --- a/.api-reports/api-report-core.md +++ b/.api-reports/api-report-core.md @@ -1562,7 +1562,10 @@ export interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_batch-http.md b/.api-reports/api-report-link_batch-http.md index ce5dded3739..cf2e7f161f9 100644 --- a/.api-reports/api-report-link_batch-http.md +++ b/.api-reports/api-report-link_batch-http.md @@ -204,7 +204,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_batch.md b/.api-reports/api-report-link_batch.md index a547973287d..6d830c0cd39 100644 --- a/.api-reports/api-report-link_batch.md +++ b/.api-reports/api-report-link_batch.md @@ -178,7 +178,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_context.md b/.api-reports/api-report-link_context.md index af79db73e52..6c9d037cf78 100644 --- a/.api-reports/api-report-link_context.md +++ b/.api-reports/api-report-link_context.md @@ -149,7 +149,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_core.md b/.api-reports/api-report-link_core.md index f488d284b51..2daef318dd8 100644 --- a/.api-reports/api-report-link_core.md +++ b/.api-reports/api-report-link_core.md @@ -149,7 +149,10 @@ export interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_error.md b/.api-reports/api-report-link_error.md index af048d6fe6b..b5e55399b81 100644 --- a/.api-reports/api-report-link_error.md +++ b/.api-reports/api-report-link_error.md @@ -198,7 +198,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_http.md b/.api-reports/api-report-link_http.md index fbd71df7348..7882b606b13 100644 --- a/.api-reports/api-report-link_http.md +++ b/.api-reports/api-report-link_http.md @@ -242,7 +242,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_persisted-queries.md b/.api-reports/api-report-link_persisted-queries.md index 14e7a0b47db..0d57c040a5f 100644 --- a/.api-reports/api-report-link_persisted-queries.md +++ b/.api-reports/api-report-link_persisted-queries.md @@ -204,7 +204,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_remove-typename.md b/.api-reports/api-report-link_remove-typename.md index f50798f5f02..8b703f577f1 100644 --- a/.api-reports/api-report-link_remove-typename.md +++ b/.api-reports/api-report-link_remove-typename.md @@ -155,7 +155,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_retry.md b/.api-reports/api-report-link_retry.md index a4a61a6ea1d..b852fc904c8 100644 --- a/.api-reports/api-report-link_retry.md +++ b/.api-reports/api-report-link_retry.md @@ -159,7 +159,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_schema.md b/.api-reports/api-report-link_schema.md index fcbee50828b..1fa99953f43 100644 --- a/.api-reports/api-report-link_schema.md +++ b/.api-reports/api-report-link_schema.md @@ -147,7 +147,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_subscriptions.md b/.api-reports/api-report-link_subscriptions.md index 8745a5772cb..038fb43bae0 100644 --- a/.api-reports/api-report-link_subscriptions.md +++ b/.api-reports/api-report-link_subscriptions.md @@ -158,7 +158,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_utils.md b/.api-reports/api-report-link_utils.md index 061cad690e5..7d0cf7eea6b 100644 --- a/.api-reports/api-report-link_utils.md +++ b/.api-reports/api-report-link_utils.md @@ -55,7 +55,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-link_ws.md b/.api-reports/api-report-link_ws.md index 72a8165e4f0..0cb2808f90f 100644 --- a/.api-reports/api-report-link_ws.md +++ b/.api-reports/api-report-link_ws.md @@ -148,7 +148,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react.md b/.api-reports/api-report-react.md index a12089d47fc..5492231ee81 100644 --- a/.api-reports/api-report-react.md +++ b/.api-reports/api-report-react.md @@ -1417,7 +1417,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: Context) => Context; + setContext: { + (context: Context): void; + (updateContext: (previousContext: Context) => Context): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react_components.md b/.api-reports/api-report-react_components.md index 75bdf5cdc69..89fc1dcee6e 100644 --- a/.api-reports/api-report-react_components.md +++ b/.api-reports/api-report-react_components.md @@ -1181,7 +1181,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react_context.md b/.api-reports/api-report-react_context.md index 89bdcc1f98d..f3c996da5a2 100644 --- a/.api-reports/api-report-react_context.md +++ b/.api-reports/api-report-react_context.md @@ -1120,7 +1120,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react_hoc.md b/.api-reports/api-report-react_hoc.md index 2a2c95db36a..2bae476feb1 100644 --- a/.api-reports/api-report-react_hoc.md +++ b/.api-reports/api-report-react_hoc.md @@ -1141,7 +1141,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react_hooks.md b/.api-reports/api-report-react_hooks.md index 8e157061ac6..f99bf5ece32 100644 --- a/.api-reports/api-report-react_hooks.md +++ b/.api-reports/api-report-react_hooks.md @@ -1364,7 +1364,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react_internal.md b/.api-reports/api-report-react_internal.md index 86141628ec6..8409066f7b6 100644 --- a/.api-reports/api-report-react_internal.md +++ b/.api-reports/api-report-react_internal.md @@ -1250,7 +1250,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-react_ssr.md b/.api-reports/api-report-react_ssr.md index 5a8d6bfde63..d4ca3a05cac 100644 --- a/.api-reports/api-report-react_ssr.md +++ b/.api-reports/api-report-react_ssr.md @@ -1105,7 +1105,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-testing.md b/.api-reports/api-report-testing.md index c02d6cfd1ec..2a3ae2f53d2 100644 --- a/.api-reports/api-report-testing.md +++ b/.api-reports/api-report-testing.md @@ -1213,7 +1213,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-testing_core.md b/.api-reports/api-report-testing_core.md index 2a3357aa0e2..142c6fcea49 100644 --- a/.api-reports/api-report-testing_core.md +++ b/.api-reports/api-report-testing_core.md @@ -1168,7 +1168,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report-utilities.md b/.api-reports/api-report-utilities.md index 02656941096..cc7fdb6b7e8 100644 --- a/.api-reports/api-report-utilities.md +++ b/.api-reports/api-report-utilities.md @@ -1903,7 +1903,10 @@ interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.api-reports/api-report.md b/.api-reports/api-report.md index 6d1e721d379..453ad594f9d 100644 --- a/.api-reports/api-report.md +++ b/.api-reports/api-report.md @@ -1922,7 +1922,10 @@ export interface Operation { // (undocumented) query: DocumentNode; // (undocumented) - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; // (undocumented) variables: Record; } diff --git a/.changeset/strange-needles-suffer.md b/.changeset/strange-needles-suffer.md new file mode 100644 index 00000000000..23cd112467b --- /dev/null +++ b/.changeset/strange-needles-suffer.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Fix operation.setContext() type diff --git a/src/link/core/types.ts b/src/link/core/types.ts index 37fdae3cb57..57fab27e83c 100644 --- a/src/link/core/types.ts +++ b/src/link/core/types.ts @@ -76,7 +76,10 @@ export interface Operation { variables: Record; operationName: string; extensions: Record; - setContext: (context: DefaultContext) => DefaultContext; + setContext: { + (context: DefaultContext): void; + (updateContext: (previousContext: DefaultContext) => DefaultContext): void; + }; getContext: () => DefaultContext; }