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
Describe the bug
I am unable to correctly type the GraphQL Context in my Yoga instance. I'm attempting to pass my Prisma Client to the context to use on resolvers, but in doing so I am getting a typescript error.
Here is an example git repo. Checkout the README for more replication details Github Repo
Type 'GraphQLSchemaWithContext<GraphQLResolveInfo & YogaInitialContext>' is not assignable to type 'YogaSchemaDefinition<GraphQLContext, {}> | undefined'.
Type 'GraphQLSchemaWithContext<GraphQLResolveInfo & YogaInitialContext>' is not assignable to type 'GraphQLSchemaWithContext<GraphQLContext & YogaInitialContext>'.
Type 'GraphQLSchemaWithContext<GraphQLResolveInfo & YogaInitialContext>' is not assignable to type '{ _context?: (GraphQLContext & YogaInitialContext) | undefined; }'.
Types of property '_context' are incompatible.
Type '(GraphQLResolveInfo & YogaInitialContext) | undefined' is not assignable to type '(GraphQLContext & YogaInitialContext) | undefined'.
Type 'GraphQLResolveInfo & YogaInitialContext' is not assignable to type '(GraphQLContext & YogaInitialContext) | undefined'.
Type 'GraphQLResolveInfo & YogaInitialContext' is not assignable to type 'GraphQLContext & YogaInitialContext'.
Property 'prisma' is missing in type 'GraphQLResolveInfo & YogaInitialContext' but required in type 'GraphQLContext'.ts(2322)
server.ts(15, 3): 'prisma' is declared here.
server.d.cts(59, 5): The expected type comes from property 'schema' which is declared here on type 'YogaServerOptions<GraphQLContext, {}>'
Expected behavior
No typescript errors
Context would be correctly typed and available in resolvers
Screenshots
Versions
Package name and version: "^0.12.0"
The text was updated successfully, but these errors were encountered:
For Issue 2 - Mapper name mismatch not generating matches
This is working as intended. If your file is called schema.graphql, then the mapper file must be called schema.mappers.ts
I think you mentioned documentation issue? Could you help point it out to me? Thanks!
After re-reading it I suppose it does say <schemaName><mappersFileExtension> but I found this confusing. No real change needed. just a suggestion. Closing issue.
Describe the bug
I am unable to correctly type the GraphQL Context in my Yoga instance. I'm attempting to pass my Prisma Client to the context to use on resolvers, but in doing so I am getting a typescript error.
Here is an example git repo. Checkout the README for more replication details
Github Repo
The code of interest:
To Reproduce
Typescript Error:
Expected behavior
Screenshots

Versions
The text was updated successfully, but these errors were encountered: