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

[Typing Error] GraphQL Schema Stitching - Part 6 (YouTube) #26

Open
valdeniomarinho opened this issue Oct 21, 2021 · 0 comments
Open

[Typing Error] GraphQL Schema Stitching - Part 6 (YouTube) #26

valdeniomarinho opened this issue Oct 21, 2021 · 0 comments

Comments

@valdeniomarinho
Copy link

Hey Ben, thanks for the project, very helpful!

I'm getting a type error exactly at this point. Probably is some conflict between schema property from GraphQLServer and the type returned by mergeSchemas() from graphql-tools.

Snippet

const schemas: GraphQLSchema[] = []

  const folders = fs.readdirSync(path.join(__dirname, './modules'))

  folders.forEach((folder) => {
    const { resolvers } = require(`./modules/${folder}/resolvers`)
    const typeDefs = importSchema(
      path.join(__dirname, `./modules/${folder}/schema.graphql`)
    )

    schemas.push(makeExecutableSchema({ resolvers, typeDefs }))
  })

  // GETTING ERROR ON THIS NEXT LINE
  const gqlServer = new GraphQLServer({ schema: mergeSchemas({ schemas }) })

Stack Backtrace:

Type 'import("/gql-ts-boilerplate/node_modules/graphql/type/schema").GraphQLSchema' is not assignable to type 'import("/gql-ts-boilerplate/node_modules/apollo-link/node_modules/graphql/type/schema").GraphQLSchema'.
  The types returned by 'getQueryType()' are incompatible between these types.
  Type 'Maybe<GraphQLObjectType<any, any>>' is not assignable to type 'Maybe<GraphQLObjectType<any, any, { [key: string]: any; }>>'.
  Type 'GraphQLObjectType<any, any>' is not assignable to type 'Maybe<GraphQLObjectType<any, any, { [key: string]: any; }>>'.
  Types of property 'isTypeOf' are incompatible.
  Type 'import("/gql-ts-boilerplate/node_modules/graphql/jsutils/Maybe").Maybe<import("/gql-ts-boilerplate/node_modules/graphql/type/definition").GraphQLIsTypeOfFn<any, any>>' is not assignable to type 'import("/gql-ts-boilerplate/node_modules/apollo-link/node_modules/graphql/tsutils/Maybe").default<import("/gql-ts-boilerplate/node_modules/apollo-link/node_modules/graphql/type/definition").GraphQLIsTypeOfFn<any, any>>'.
  Type 'GraphQLIsTypeOfFn<any, any>' is not assignable to type 'Maybe<GraphQLIsTypeOfFn<any, any>>'.
  Types of parameters 'info' and 'info' are incompatible.
  Property 'cacheControl' is missing in type 'import("/gql-ts-boilerplate/node_modules/apollo-link/node_modules/graphql/type/definition").GraphQLResolveInfo' but required in type 'import("/gql-ts-boilerplate/node_modules/graphql/type/definition").GraphQLResolveInfo'.
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