graphql-hive
graphql-hive copied to clipboard
Cannot find module 'apollo-server-plugin-base' or its corresponding type declarations
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 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.
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
}
}
@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?)
Hmm, am not fully sure but cant we just not export apollo from index? So that apollo needs to be imported directly.
@dotansimha I think a seperate package is the best option here
https://github.com/kamilkisiela/graphql-hive/issues/4571
https://the-guild.dev/graphql/hive/product-updates/2024-04-23-graphql-server-integrations-workers-support