Typing Changes in Apollo Client 3.12.16 Generating TS2589 & TS7031 Errors

Upgrading from Apollo Client 3.12.15 to 3.12.16 in an Apollo-Angular 8.0.0 / Angular 19 project generates two sets of TypeScript errors when building with tsc under TypeScript 5.7.3 (masked by a FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory error unless tsconfig.json has compilerOptions: { skipLibCheck: true } set).

The first error is error TS2589: Type instantiation is excessively deep and possibly infinite on MutationUpdaterFunctions with recursively nested result types. This is happening with several types that do have circular references but worked fine in Apollo Client 3.12.15 and previous versions. From looking at the diffs, I’m assuming this is occurring because of the changes to Unmasked as I see that type used in the MutationUpdaterFunction.

The second error is error TS7006: Parameter '' implicitly has an 'any' type. on Cache.ModifyOptions Modifier function. I’m not sure why the previously working typing passed to the generic is not working.

Can anyone shed light on the TypeScript typing changes made in Apollo Client 3.12.16?

1 Like

Could you please open an issue on this and also provide a small repository that shows this occuring?

Thanks for your reply, @lenz. Is there a minimal Apollo Client TypeScript starter project I can clone and modify with sample nested result types I’m experiencing these errors with?

You could get started with GitHub - apollographql/react-apollo-error-template: Apollo Client issue reproduction. (it might need an Apollo Client update).