Skip to content

Commit 392335b

Browse files
Jaime02Jaime ResanoAman Varshneyclaude
authored
fix(graphql-subscriptions): fix asyncIterableIterator and improve payload typing (#8040)
* Fix pubsub.asyncIterator * Fix pubsub.asyncIterator and improve payload typing - Replace deprecated asyncIterator with asyncIterableIterator - Type resolve payload using generated Prisma Post type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Jaime Resano <gemailpersonal02@gmail.com> Co-authored-by: Aman Varshney <aman@Amans-MacBook-Pro.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fcda24a commit 392335b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

orm/graphql-subscriptions/src/schema.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
arg,
1111
inputObjectType,
1212
} from 'nexus'
13+
import type { Post } from '../prisma/generated/client'
1314
import { Context } from './context'
1415

1516
const User = objectType({
@@ -159,8 +160,8 @@ export const Subscription = subscriptionType({
159160
subscribe(_root, _args, ctx) {
160161
return ctx.pubsub.asyncIterableIterator('newPost')
161162
},
162-
resolve(payload) {
163-
return payload as Awaited<ReturnType<Context['prisma']['post']['create']>>
163+
resolve(payload: Post) {
164+
return payload
164165
},
165166
})
166167

@@ -169,8 +170,8 @@ export const Subscription = subscriptionType({
169170
subscribe(_root, _args, ctx) {
170171
return ctx.pubsub.asyncIterableIterator('postPublished')
171172
},
172-
resolve(payload) {
173-
return payload as Awaited<ReturnType<Context['prisma']['post']['create']>>
173+
resolve(payload: Post) {
174+
return payload
174175
},
175176
})
176177
},

0 commit comments

Comments
 (0)