graphql-hive icon indicating copy to clipboard operation
graphql-hive copied to clipboard

Cannot find module 'apollo-server-plugin-base' or its corresponding type declarations

Open robertherber opened this issue 3 years ago • 2 comments
trafficstars

I'm using this library with graphql-yoga and fastify and I end up with having to install apollo-server-plugin-base because I'm getting this type error:


import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/@graphql-hive/client/apollo.d.ts```

robertherber avatar Jul 01 '22 13:07 robertherber

@robertherber have you solved this without needing to install apollo-server-plugin-base? I'm getting running into the error... I could probably use skipLibCheck in my tsconfig.json but I think this should rather be fixed in this package.

davidruisinger avatar Sep 29 '22 10:09 davidruisinger

Intermediate fix:

Create a missing_apollo_types.d.ts (name does not matter) file in your project with the following content:

declare module 'apollo-server-plugin-base' {
  interface ApolloServerPlugin {
    _: unknown
  }
}

davidruisinger avatar Sep 29 '22 11:09 davidruisinger

@ardatan @enisdenjo @kamilkisiela can we use Bob to create a different entry point for the apollo.ts file? This way it will not get loaded by TS by default? It seems like the export in https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/index.ts#L3 requires users to have that package as a dependency, or it fails compilation?

(I know skipLibCheck is also an option here, but I wasn't sure if that's the recommendation for such case?)

dotansimha avatar Dec 12 '22 18:12 dotansimha

Hmm, am not fully sure but cant we just not export apollo from index? So that apollo needs to be imported directly.

enisdenjo avatar Dec 19 '22 09:12 enisdenjo

@dotansimha I think a seperate package is the best option here

ardatan avatar Dec 19 '22 13:12 ardatan

https://github.com/kamilkisiela/graphql-hive/issues/4571

kamilkisiela avatar Apr 23 '24 11:04 kamilkisiela

https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support

kamilkisiela avatar Apr 23 '24 16:04 kamilkisiela