Replies: 1 comment 2 replies
-
|
TypeGraphQL produces standard GraphQL schema. You can you all the tools for GraphQL for frontend to have typesafe queries, like graphql code generator. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm developing an app that uses type-graphql + apollo server on the backend, and the apollo client + react for the frontend. Right now I have my repo split into 3 packages: client, server, and schema.
Server imports the schema, creates the resolver for it, and then does a
buildSchema()for theApolloServer.On the client side, I import just the schema as types, and pass them as the generic type to
ApolloClient.useQuery<Type>().This generally seems to work well. Is there a different or better way to do things?
One big problem I've noticed (though maybe its more specific to Apollo than sharing the schema), is that the type returned from
useQueryis ignorant of the actual query itself. So if my type/schema isand my query is
The returned
dataobject fromuseQuery()only actually has theidandtitleproperties, but because the schema type hasdescriptioncreationDateandingredientsas well, typescript things that those exist ondataeven though they don't. Is there any way to address this?Beta Was this translation helpful? Give feedback.
All reactions