I don’t think the Resolver type is quite correct. Resolvers can be functions but also Record<string, Resolver>
for example I might have
export const UserProfile: Pick<UserProfileResolvers, 'isFollowedByCurrentUser'> = {
isFollowedByCurrentUser: async (_obj, { root }) => {
if (context.currentUser) {
const followRelationship = await db.follows.findFirst({
where: { followerId: context.currentUser.id, followingId: root.id },
})
return !!followRelationship
}
},
Very useful to only compute isFollowedByCurrentUser
is it is requested by the corresponding frontend GraphQL query
This does not cause any problem in the boilerplate redwood JS app, because somehow the glob import
import services from 'src/services/**/*.{js,ts}'
doesn’t catch that mistyping. But I ran into problems with that glob pattern being too inclusive, and I preferred declaring things more explicitly:
import * as services from 'src/services'
And then the problem occurs, so I need to do:
// eslint-disable-next-line @typescript-eslint/no-explicit-any
services: services as any,
until we find a fix for that.
Happy to work on it if that’s acknowledged as an issue