Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createResolversMap returns an incompatible type #1768

Open
rosscooperman opened this issue Nov 14, 2024 · 0 comments
Open

createResolversMap returns an incompatible type #1768

rosscooperman opened this issue Nov 14, 2024 · 0 comments

Comments

@rosscooperman
Copy link

Describe the Bug
Following the example from https://github.com/MichalLytek/type-graphql/tree/v2.0.0-rc.2/examples/apollo-federation-2. It seems that the return type of createResolversMap (ResolversMap) is not compatible with the current version of buildSubgraphSchema from @apollo/subgraph. Full typescript error is:

Diagnostics:
1. Argument of type '{ typeDefs: DocumentNode; resolvers: ResolversMap; }' is not assignable to parameter of type 'DocumentNode |
(DocumentNode | GraphQLSchemaModule)[] | LegacySchemaModule'.
     Types of property 'resolvers' are incompatible.
       Type 'ResolversMap' is not assignable to type 'GraphQLResolverMap<unknown>'.
         'string' index signatures are incompatible.
           Type 'GraphQLScalarType<unknown, unknown> | EnumResolver | ResolverOptions<any, any> | ResolverObject<any, any>' is not
assignable to type 'GraphQLScalarType<unknown, unknown> | { [enumValue: string]: string | number; } | { [fieldName: string]:
GraphQLFieldResolver<any, unknown> | { requires?: string | undefined; resolve?: GraphQLFieldResolver<...> | undefined; subscribe?:
GraphQLFieldResolver<...> | undefined; }; }'.
             Type 'ResolverOptions<any, any>' is not assignable to type 'GraphQLScalarType<unknown, unknown> | { [enumValue: string]:
string | number; } | { [fieldName: string]: GraphQLFieldResolver<any, unknown> | { requires?: string | undefined; resolve?:
GraphQLFieldResolver<...> | undefined; subscribe?: GraphQLFieldResolver<...> | undefined; }; }'.
               Type 'ResolverOptions<any, any>' is not assignable to type '{ [fieldName: string]: GraphQLFieldResolver<any, unknown> | {
requires?: string | undefined; resolve?: GraphQLFieldResolver<any, unknown> | undefined; subscribe?: GraphQLFieldResolver<...> |
undefined; }; }'.
                 Index signature for type 'string' is missing in type 'ResolverOptions<any, any>'. [2345]

To Reproduce
Attempt to build a schema as in https://github.com/MichalLytek/type-graphql/blob/v2.0.0-rc.2/examples/apollo-federation-2/helpers/buildFederatedSchema.ts with the latest type-graphql and @apollo/subgraph.

Expected Behavior
Return value of createResolversMap should be compatible with buildSubgraphSchema.

Environment (please complete the following information):

  • OS: MacOS 15.0.1
  • Node 20.12.2
  • Package version 2.0.0-rc.2
  • TypeScript version 5.4.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant