You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportconstpostQueries=queryField(t=>{t.connectionField("getAllPublishedPosts",{type: PostType,cursorFromNode: ({ id })=>id,additionalArgs: {filter: nullable(stringArg()),},nodes: async(_,{ first, after, filter },{ prisma })=>{constposts=awaitprisma.post.findMany({where: {AND: [{published: true},{OR: filter
? [{content: {contains: filter,mode: "insensitive"}},{title: {contains: filter,mode: "insensitive"}},]
: undefined,},],},take: first+1,skip: after ? 1 : 0,cursor: after ? {id: after} : undefined,})returnposts},extendConnection: t=>{t.int("totalCount",{resolve: (_,{ filter }: {filter?: string},{ prisma })=>// args are not typed here. had to type manuallyprisma.post.count({where: {AND: [{published: true},{OR: filter
? [{content: {contains: filter,mode: "insensitive"}},{title: {contains: filter,mode: "insensitive"}},]
: undefined,},],},}),})},})})
I was expecting args to be typed on the extendConnection resolver but typescript keeps complaining that filter has any type. root and ctx are typed though...
Am I missing something?
The text was updated successfully, but these errors were encountered:
I have the following code:
I was expecting args to be typed on the
extendConnection
resolver but typescript keeps complaining that filter hasany
type.root
andctx
are typed though...Am I missing something?
The text was updated successfully, but these errors were encountered: