-
|
The withHooks option on the apollo typescript is awesome because it ties together and makes typesafe the query, the variables, and the response object into a single, beautiful, function. I've been poking around, but I don't see the ability to generate similar wrappers for use against the imperative query/watchQuery/mutate methods on the ApolloClient instance, itself. In other words, assuming there's a query called GetDogs, have the tool genereate something like Then, instead of having to do You could simply do Thanks for making such an awesome tool! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
|
@twmillett I believe TypedDocumentNode solves the problem you're trying to solve (needing to import Only downside of that solution is that for now you need to install a beta version of Apollo Client.. |
Beta Was this translation helpful? Give feedback.
-
|
I wanted to keep my hooks so I ended up removing the apollo react plugin and writing a simple one that uses what the typed document node gives us: with the codegen file being: |
Beta Was this translation helpful? Give feedback.
@twmillett I believe TypedDocumentNode solves the problem you're trying to solve (needing to import
FooQueryandFooQueryVariablesand use them as generics for query/mutate/watchQuery calls).Only downside of that solution is that for now you need to install a beta version of Apollo Client..
3.2.0-beta.2