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
However, when combined with a mapped type, this code is incorrect. ParentType is the mapped object, which may not have an id property at all, or its id property may be a completely unrelated type.
schema: "src/schema.ts"documents: nullgenerates:
src/generated/schema.ts:
plugins:
- "typescript"
- "typescript-resolvers"config:
avoidOptionals: trueimmutableTypes: truemappers:
# Map GraphQL types in your schema to typescript types that are returned by resolvers and passed to child resolvers.User: ../user#UseruseIndexSignature: truetypesPrefix: "I"federation: true
Would appreciate a fix for this, as our generated code won't compile when using @key on types using mappers. Thanks for all the work done on this great tool.
Describe the bug
When using typescript-resolvers with
federation: true
. The generated code for the resolver uses the following type for the resolver:However, when combined with a mapped type, this code is incorrect.
ParentType
is the mapped object, which may not have anid
property at all, or its id property may be a completely unrelated type.To Reproduce
Steps to reproduce the behavior:
codegen.yml
config file:Expected behavior
My code should type-check correctly.
Actual behavior
Type '"id"' does not satisfy the constraint 'keyof ParentType'.
Environment:
Additional context
I am going to make a sample repo for this shortly, because the code samples above are artificial extractions from a larger running project.
The text was updated successfully, but these errors were encountered: