Skip to content
Discussion options

You must be logged in to vote

I don't think you can use __typename as this is for introspection.
It will always return the type of id and name, and not the values

What you could do:

  • userEvents returns an interface, that UserCreated implements.
  • then the query would look like:
subscription {
    userEvents {
        ... on UserCreated {
            id
            name
    }
}

Inside the resolve function, you have access to ctx.astFields. With that, you could find the information UserCreated and adapt the resolution.

Another way is to use parameters:

subscription {
    userEvents(eventTypes: "UserCreated") {
        ... on UserCreated {
            id
            name
    }
}

but it's a bit redundant.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PvtPuddles
Comment options

Answer selected by PvtPuddles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants