Leaky abstraction on typescript types generation for apollo project. #6183
Unanswered
JustFly1984
asked this question in
Q&A
Replies: 1 comment 9 replies
-
I also had to change generated types before:
after:
still thinking how to change types to add support for async functions as props in |
Beta Was this translation helpful? Give feedback.
9 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.
-
I'm working on apollo server app. I have a schema from another app written in Ruby, and using types generated with
graphql-code-generator
a graphql type, for example:
results in typescript type declaration which looks like this:
Two issues I see here is over-fetch data from DataBase, for fields not requested by the client.
The solution is pretty simple: It requires to wrap imported type in
Partial
utility type, to not , do not make joins in SQL, etc.and that is pretty much equal to
But here is a second issue: you can't replace values with async functions, which should be possible due to existing apollo server functionality, to escape over-fetching in query and mutation function resolvers.
Am I missing something? Should type generation to be improved for apollo projects?
Beta Was this translation helpful? Give feedback.
All reactions