Skip to content

pubsub.asyncIterator should return an AsyncIterable #555

@hayes

Description

@hayes

See apollographql/graphql-subscriptions#261

This is the exact same issue as described in the issue linked above.

The returned AsyncIterator also implements the AsyncIterable interface (having an [Symbol.asyncIterator] property). GraphQL subscriptions expect an async iterable, not an async iterator, so this works at run time, but the typings are incomplete. Many of the type-definitions for subscribe functions are wrong, so this issue has gone un-resolved for a long time, but technically the correct thing here is to update the return type so that it correctly indicates that the returned value is both an AsyncIterator and an AsyncIterable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions