graphql-tools
graphql-tools copied to clipboard
graphql-tools/links: v8.2.2 types not compatible with graphql v15
Describe the bug
When I type check my project with @graphql-tools/[email protected] and [email protected], I get this output:
node_modules/@graphql-tools/links/GraphQLUpload.d.ts:2:30 - error TS2315: Type 'GraphQLScalarType' is not generic.
2 declare const GraphQLUpload: GraphQLScalarType<any, unknown>;
To Reproduce Steps to reproduce the behavior:
- In a local graphql-tools repository, run
yarn build - Run
yarn add graphql@15 -Wto override what's currently in the package.json devDependencies - Run
./node_modules/.bin/tsc --noEmit dist/links/src/GraphQLUpload.d.ts - See the error pasted above
Expected behavior
No TypeScript error
Environment:
- OS: macOS 12.3
@graphql-tools/...:@graphql-tools/[email protected]- NodeJS: 16.14.0
Additional context
GraphQLScalarType was made generic in graphql@16.
The fix for this in my project right now is to stay on @graphql-tools/[email protected], which should be good for us for a while. But I wanted to note the type incompatibility with an allowed peer dependency.
Just adding a tip: sometimes you can set the tsconfig.compilerOptions.skipLibCheck to true to skip /node_modules/* checks:
// tsconfig.json
{
// ...
"compilerOptions": {
"skipLibCheck": true,
// ...
},
// ...
}
It seems we don't use generics anymore so the issue should be fixed in GraphQL v15. Let us know if this is still happening. See https://github.com/ardatan/graphql-tools/blob/master/packages/links/src/GraphQLUpload.ts#L4 Closing the issue for now.