You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MyQueryInterface defines the variable data's type.
Now I have a use-case where the data from the Query is an array and the subscribeToMore subscription returns me any new array element that are created.
For example, the interface for query might be
Now in the subscribeToMore function I have to combine these two and it works fine if I do not type my query but if I do type them the subscription data doesn't have a someArray and it throws a type error.
If I could provide types for my subscription in subscribeToMore like I can give types to my query data and query variables...that would be nice.
Like:
Do let me know if this feature is a duplicate or is not valid...I'll provide some more context.
EDIT:
This is not in the docs but I found this is possible and I solved the problem but don't know if this is the proper method.
I put an interface just before calling subscribeToMore like this:
@arkajyotiMukherjee thanks for reporting this, I'll move this over to the Apollo Client project and determine if we can make a documentation improvement on this topic.
jpvajda
transferred this issue from apollographql/apollo-feature-requests
Jul 26, 2022
The
MyQueryInterface
defines the variabledata
's type.Now I have a use-case where the data from the Query is an array and the subscribeToMore subscription returns me any new array element that are created.
For example, the interface for query might be
but my subscription data returns
Now in the
subscribeToMore
function I have to combine these two and it works fine if I do not type my query but if I do type them the subscription data doesn't have asomeArray
and it throws a type error.If I could provide types for my subscription in
subscribeToMore
like I can give types to my query data and query variables...that would be nice.Like:
Do let me know if this feature is a duplicate or is not valid...I'll provide some more context.
EDIT:
This is not in the docs but I found this is possible and I solved the problem but don't know if this is the proper method.
I put an interface just before calling
subscribeToMore
like this:If you think this solution is expected we can close this issue or take some steps to add it to the docs.
Thanks in advance.
The text was updated successfully, but these errors were encountered: