Closed JoviDeCroock closed 10 months ago
Thank you so much for the kind words! It's not really possible to extend a type from a different file. Type definitions can't really be "updated" in TypeScript. The way this is done currently is by returning a modified class.
Basically you will end up with two variants of the same root type.
We can make the type extendable in the same file (just like the implements
modifier). You will still have to import the types from elsewhere into the main file though, if you want the changes to be available globally. Pothos has a similar issue, so there's no way around it as it's a TypeScript limitation 🤷
Btw. Can I ask what other framework, if any you're using with your current approach?
I managed to pull it off with pothos by doing addQueryField 😅 missing the inferClientTypes though
I have added an experimental extend
modifier in 0.6.3.
More: https://garph.dev/docs/guide/schemas.html#extend
Hey,
I have been trying out
garph
and been loving the idea's behind it, however I have run into a few missing things for organising bigger structures.I see the similarity with both https://github.com/stepci/garph/issues/39 and https://github.com/stepci/garph/issues/78 and if it's too similar feel free to close this issue.
That being said, I was looking at trying out this project and tried my regular approach of doing
types/User
andtypes/Todo
, where both of these define ag.type('Query')
which seemed to override one another 😅 I think it would be really beneficial if we could extend theQuery
type in multiple files so we don't have to import everything from everywhere.I guess one of the limitations here would be the type-system, y'all have something great going with the
InferClient
, ... If I can help out anywhere feel free to say so as well