Breaking change with @defer changes and apollo angular package
See original GitHub issueIntended outcome: My angular project utilizing @graphql-codegen, apollo-angular, and @apollo/client should build properly
Actual outcome: Where the code attempts to perform a mutation and manipulate the result, there is a typescript error stating that “property ‘data’ does not exist on type ‘MutationResult<…’”.
This is because the MutationResult
interface in the apollo-angular package extends the FetchResult
type in @apollo/client. When making changes to the @apollo/client types to support @defer
(specifically here), FetchResult
was changed from an interface to a type, and more importantly, it is set equal to a union type.
The above will cause a “An interface can only extend an object type or intersection of object types with statically known members” error if the apollo-angular package uses apollo-client v3.7.0. That is what “removes” the data property from the mutation result object.
How to reproduce the issue: I don’t have a reproduction, but if you try to define your own MutationResult like the apollo-angular package does, I assume you’ll get the error. That, or go about it the long way and have a project with the packages I outlined above, create a mutation, and try to access the data property of the result.
This issue is also brought up in the apollo-angular project’s github repo: https://github.com/kamilkisiela/apollo-angular/issues/1818
Versions “@apollo/client”: “3.7.0”, “apollo-angular”: “3.0.1”, “@graphql-codegen/cli”: “2.13.2”,
System: OS: Windows 10 10.0.19044 Binaries: Node: 16.13.2 - C:\Program Files\nodejs\node.EXE npm: 7.5.6 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1266.0), Chromium (106.0.1370.34)
Issue Analytics
- State:
- Created a year ago
- Reactions:16
- Comments:10 (5 by maintainers)
Top GitHub Comments
Hello, just a friendly reminder to please wrap
@defer
inside of backticks (``
) to avoid accidentally tagging the github user nameddefer
. Thanks!@andrii-lundiak thanks for sharing 🙏🏻 Unfortunately I’m not able to determine much from this
package.json
. I recommend creating a runnable reproduction via a repo or codesandbox so we can determine expected vs. actual behavior in concrete terms. If anyone else in the thread is experiencing this issue I’d be eager to hear your experiences as well!