You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to me like arguments for subscription resolvers are all of type any. I got this after running the code generator with the Typescript Resolvers plugin:
To Reproduce
Steps to reproduce the behavior:
Run the code generator with the typescript resolvers plugin on a schema with subscriptions. I think this should result in the same issue.
Reproduction Repo: https://codesandbox.io/s/magical-pare-hl1sv?file=/schema.graphql
I would expect subscription resolvers to have typed arguments which should be exactly the same as the arguments for query and mutation resolvers. Environment:
See reproduction repo, or check these version numbers:
The union of SubscriptionSubscriberObject and SubscriptionResolverObject is apparently not compatible or something. I don't know what's the term for this, but Typescript apparentely gives up to match the types. You can see it starting to work (kind of), if you remove either SubscriptionResolverObject or SubscriptionSubscriberObject from the union.
However, with SubscriptionResolverObject you'll get any even if you define a custom parent type (with allowParentTypeOverride in codegen). What's also weird is that the resolve fn is mandatory, even though I've only ever seen it optional.
With SubscriptionSubscriberObject, the parent type is the result of the subscription even if you override the parent type, which is also wrong afaict. Because the resolve function provides the result in the first place.
I think there should be only one possible subscription object:
But that's probably too simple.
I don't really understand why there are two types of SubscriptionObjects. Maybe the idea was that you could handle both the cases: the subscribe fn or the resolve fn produces the result. If the subscribe fn already produces the result, the resolve fn would get as the parent type. If the subscribe fn produces an intermediate value, this would be the parent type.
But for that to work you'd need to split the parent type and the "payload type" for resolve.
Describe the bug
It seems to me like arguments for subscription resolvers are all of type
any
. I got this after running the code generator with the Typescript Resolvers plugin:What is the reason for
...args: any[]
?To Reproduce
Steps to reproduce the behavior:
Run the code generator with the typescript resolvers plugin on a schema with subscriptions. I think this should result in the same issue.
Reproduction Repo: https://codesandbox.io/s/magical-pare-hl1sv?file=/schema.graphql
Check line 88 in types.ts.
# None
codegen.yml
config file:Expected behavior
I would expect subscription resolvers to have typed arguments which should be exactly the same as the arguments for query and mutation resolvers.
Environment:
See reproduction repo, or check these version numbers:
The text was updated successfully, but these errors were encountered: