-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL Aliases #22
Comments
Aliases are not supported right now, because I couldn't think of a nice syntax that would allow describing aliases in TS, while also preserving auto-completion support :) Suggestions are welcome |
this looks reasonable to me, and also it would be easy to preserve typing and intellisense client.query({
originalQueryName: {
__alias: {
newQueryName: {
field: true,
},
},
},
}) |
Maybe something along the lines of: client.aliased.query({
first: {
product: [input, {
}]
},
second: {
product: [input, {
}]
}
}) I think at type level it should be possible to turn |
I've just ran into a situation where I need to use aliases in my query and I would love to see this added. I would've expected something similar to how |
Is there anyway to specify an alias in the query object?
My use case - I have a list of product ID's that I want to fetch from shopify. I want to fetch the products all at once, so would usually programatically create a gql string like so:
I can create an object similar to the above to pass into query, but obviously can't have multiple
product: [{}]
as they are duplicate keys. Or perhaps there is a way to create a chain with a number of queries?Hope that makes sense..?
The text was updated successfully, but these errors were encountered: