-
Notifications
You must be signed in to change notification settings - Fork 135
Description
the pubsub.asyncIterator method currently is typed as returning an AsyncIterator. While this is accurate, it misses an important detail:
The subscribe function of a graphql field expects an AsyncIterable, not an AsyncIterator. At runtime this works because the PubSubAsyncIterator also implements the AsyncIterable interface. Unfortunately this is hidden by the explicit return type in pubsub.asyncIterator Which is typed as returning an AsyncIterator, not a PubSubAsyncIterator, and does not include the [Symbol.asyncIterator] property.
This library is very commonly used when implementing graphql subscriptions, and I believe this has resulted in it becoming common to mis-type the expected return type of subscribe functions (for example in nexus)
This should be a relatively easy, and backwards compatible fix