Understanding the use case for the typescript-resolvers plugin #7131
-
If I'm using resolvers for certain queries on my GraphQL server backend (graphql-ruby in my case) does that mean I should use the Or am I misunderstanding the use case, maybe it is for a different type of resolver? The issue i've run into is i'm getting a malformed generated query type, where the type is explicitly omitting my query variables from a watched query, whereas i do want the variables in the query (because in my implementation, i want it to refetch when those variables change). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think the main reason (or at least my main reason) for using the Without the plugin the typing of all your resolvers would be track?: Resolver<ResolversTypes['Track'], ParentType, ContextType, RequireFields<QueryTrackArgs, 'id'>>; |
Beta Was this translation helpful? Give feedback.
I think the main reason (or at least my main reason) for using the
typescript-resolvers
plugin is to automatically generate types for an Apollo like resolver. Here is an example I made a few weeks ago.Without the plugin the typing of all your resolvers would be
(any, any, any, any)
. This is not ideal in a TS project. However, if you use the plugin and type your root resolver correctly you get strongly typed resolvers.