I am currently trying to set up a subscription using graphql codegen types.
import { Context } from '../context'
import { SubscriptionResolvers } from '../../generated/graphql'
const NEW_POINT = 'NEW_POINT'
export const Subscription: SubscriptionResolvers = {
scoreUpdated: {
subscribe: (_parent, _args, context: Context) => {
return context.pubsub.asyncIterator(NEW_POINT)
},
},
}
The error I’m getting when I hover over subscribe is:
Type '(_parent: {}, _args: {}, context: Context) => AsyncIterator<unknown, any, undefined>' is not assignable to type 'SubscriptionSubscribeFn<any, {}, any, {}>'.
Type 'AsyncIterator<unknown, any, undefined>' is not assignable to type 'AsyncIterable<any> | Promise<AsyncIterable<any>>'.
Type 'AsyncIterator<unknown, any, undefined>' is missing the following properties from type 'Promise<AsyncIterable<any>>': then, catch, finally, [Symbol.toStringTag]ts(2322)
I’m not sure what I’m missing to get this working. What am I missing?