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

graphql-tools/links: v8.2.2 types not compatible with graphql v15

Open rosston opened this issue 3 years ago • 1 comments

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:

  1. In a local graphql-tools repository, run yarn build
  2. Run yarn add graphql@15 -W to override what's currently in the package.json devDependencies
  3. Run ./node_modules/.bin/tsc --noEmit dist/links/src/GraphQLUpload.d.ts
  4. See the error pasted above

Expected behavior

No TypeScript error

Environment:

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.

rosston avatar Mar 15 '22 15:03 rosston

Just adding a tip: sometimes you can set the tsconfig.compilerOptions.skipLibCheck to true to skip /node_modules/* checks:

// tsconfig.json
{
  // ...
  "compilerOptions": {
    "skipLibCheck": true,
    // ...
  },
  // ...
}

alexcmgit avatar Oct 08 '22 18:10 alexcmgit

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.

ardatan avatar Mar 29 '23 05:03 ardatan