-
Graphql yoga docs mention this. But it would require too much manual work. I'd also like to pass this pubsub object to the context object. I have a custom type for context object which I feed to code generator to properly type it inside resolvers. I'd like the pubsub object to be fully typed inside resolvers. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @xoldyckk, can you please clarify what you mean by generating types for the PubSub object? The payloads of the PubSub are highly dependent on the type of application you are building and it would be hard to generate generalized types for that. In practice, we could generate payloads for the "GraphQL" object type a Subscription field is resolving to. However, the PubSub payload rarely contains the full entity. E.g. the payload could be just a string that is the id of an entity that is then loaded within the Subscription field resolver or mapped to/filtered in the subscription field source using the (map/filter) helpers. |
Beta Was this translation helpful? Give feedback.
-
I just remembered that I can infer the type of pubsub object from where I create it and just pass that into code generator. Nevermind. |
Beta Was this translation helpful? Give feedback.
I just remembered that I can infer the type of pubsub object from where I create it and just pass that into code generator. Nevermind.