Skip to content

chore: updates apollo-client and graphql to latest#594

Merged
v3nant merged 1 commit into
mainfrom
chore/gql-apollo-update
Jun 16, 2026
Merged

chore: updates apollo-client and graphql to latest#594
v3nant merged 1 commit into
mainfrom
chore/gql-apollo-update

Conversation

@v3nant

@v3nant v3nant commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bumps @apollo/client from ^4.1.9^4.2.3
  • Bumps graphql from ^16.13.2^17.0.0 (Apollo 4.2.x declares support for both ^16 and ^17)
  • Adds module augmentations to apollo.client.ts to satisfy Apollo 4.2.x's new type-safety requirements

Why the type augmentations are needed

Apollo Client 4.2 introduced two breaking type-system changes:

1. DeclareDefaultOptions — required before using errorPolicy as a default

Apollo 4.2 uses a type-guard pattern that makes errorPolicy in defaultOptions resolve to an error-message string type unless explicitly declared via module augmentation. Without this, the createApollo factory produced a TS2322 error.

2. SignatureStyle — modern vs. classic call signatures

Declaring non-empty DeclareDefaultOptions interfaces causes Apollo to automatically switch client.mutate and client.query to the new "modern" signature style, which:

  • Requires TypedDocumentNode and type inference
  • Does not accept explicit <TData, TVariables> type arguments

Since all existing call sites use explicit generics against plain DocumentNode, we pin signatureStyle: 'classic' in TypeOverrides to preserve backward-compatible behavior.

Future work: migrating to the modern signature style involves typing each gql document as TypedDocumentNode<ResponseType, VariablesType> and removing explicit generic arguments from all client.mutate/client.query call sites. The five documents in gql-operations.ts are the starting point.


Test plan

  • npm run typecheck passes with zero errors
  • npm test passes
  • Manual smoke test: hd scan completes successfully

@v3nant v3nant merged commit 520c867 into main Jun 16, 2026
24 checks passed
@v3nant v3nant deleted the chore/gql-apollo-update branch June 16, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants