Easier context binding #41
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a potential solution to the "it's weird and is a lot of copy and pasting big files to get @graphql-ts/schema's API bound to a context with all the types available to make it easy to define circular types" problem.
This is an example of what can be written with it:
Note the
type g<...> = ...and theg<"object", Person>, this is the new thing here.While this is certainly a strange API, it seems like the least bad option to easily bind the API to a context.
The main question is what precisely should the
gtype support. Currently it is:There's some awkward things here:
gand not things from@graphql-ts/schemaFieldis not included.Fieldlikely isn't a big problem since the type itself shouldn't be used very often since it isn't needed for circularity. It's not included since it would require 4 type params (excluding context)