zapier / apollo-server-integration-testing

Test helper for writing apollo-server integration tests
MIT License
133 stars 21 forks source link

Incompatible types with apollo-server-express 2.12.0 #6

Open darky opened 4 years ago

darky commented 4 years ago
Type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-express/dist/ApolloServer").ApolloServer' is not assignable to type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-integration-testing/node_modules/apollo-server-express/dist/ApolloServer").ApolloServer'.
  The types returned by 'createGraphQLServerOptions(...)' are incompatible between these types.
    Type 'Promise<import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-express/node_modules/apollo-server-core/dist/graphqlOptions").GraphQLServerOptions<Record<string, any>, any>>' is not assignable to type 'Promise<import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-core/dist/graphqlOptions").GraphQLServerOptions<Record<string, any>, any>>'.
      Type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-express/node_modules/apollo-server-core/dist/graphqlOptions").GraphQLServerOptions<Record<string, any>, any>' is not assignable to type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-core/dist/graphqlOptions").GraphQLServerOptions<Record<string, any>, any>'.
        Types of property 'executor' are incompatible.
          Type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-express/node_modules/apollo-server-types/dist/index").GraphQLExecutor<Record<string, any>> | undefined' is not assignable to type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-types/dist/index").GraphQLExecutor<Record<string, any>> | undefined'.
            Type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-express/node_modules/apollo-server-types/dist/index").GraphQLExecutor<Record<string, any>>' is not assignable to type 'import("/Users/vladislavbotvin/Projects/bla-bla/node_modules/apollo-server-types/dist/index").GraphQLExecutor<Record<string, any>>'.
              Types of parameters 'requestContext' and 'requestContext' are incompatible.
                Type 'WithRequired<GraphQLRequestContext<Record<string, any>>, "queryHash" | "document" | "operation" | "operationName">' is not assignable to type 'GraphQLRequestContextExecutionDidStart<Record<string, any>>'.
                  Property 'logger' is missing in type 'GraphQLRequestContext<Record<string, any>> & Required<Pick<GraphQLRequestContext<Record<string, any>>, "queryHash" | "document" | "operation" | "operationName">>' but required in type 'GraphQLRequestContext<Record<string, any>>'.ts(2322)
index.d.ts(51, 5): 'logger' is declared here.
index.d.ts(9, 5): The expected type comes from property 'apolloServer' which is declared here on type 'TestClientConfig'

2.11.0 version fine

vitorbal commented 4 years ago

@darky thanks for the report. Feel free to open a pull request to fix this. We haven't updated to apollo-server-express 2.12.0 internally yet so I won't be able to prioritize this right now.

If a PR is not possible, then a repository where it can be reproduced would be great 👍 thanks!

gustawdaniel commented 2 years ago

Anyway, it should be better to give the user which implementation of apollo he wants to use:

In my case I need apollo-server, no apollo-server-express

https://www.apollographql.com/docs/apollo-server/integrations/middleware#apollo-server

and have errors in typescript, that my pure server (without express) is incompatible:

Screenshot 2022-04-15 at 19 32 32