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

@graphql-tools/utils 10.6.4 not compatible to Typescript >= V5

Open to-kn opened this issue 1 year ago • 7 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [x] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

Since Version 10.6.4 we get typecheck-errors in our Pipeline:

kcd-scripts typecheck node_modules/@graphql-tools/utils/typings/fakePromise.d.ts:2:37 - error TS1139: Type parameter declaration expected. 2 export declare function fakePromise(value: T): Promise; ~~~~~ node_modules/@graphql-tools/utils/typings/fakePromise.d.ts:2:44 - error TS1005: ',' expected. 2 export declare function fakePromise(value: T): Promise; ~ node_modules/@graphql-tools/utils/typings/fakePromise.d.ts:2:51 - error TS1005: ')' expected. 2 export declare function fakePromise(value: T): Promise; ~ node_modules/@graphql-tools/utils/typings/fakePromise.d.ts:2:53 - error TS1434: Unexpected keyword or identifier. 2 export declare function fakePromise(value: T): Promise; ~ node_modules/@graphql-tools/utils/typings/fakePromise.d.ts:2:54 - error TS1128: Declaration or statement expected. 2 export declare function fakePromise(value: T): Promise; ~ node_modules/@graphql-tools/utils/typings/fakePromise.d.ts:2:55 - error TS1128: Declaration or statement expected. 2 export declare function fakePromise(value: T): Promise; ~ Found 6 errors.

Expected behavior

No Typescript-errors are thrown

Environment:

  • OS:
  • @graphql-tools/utils: 10.6.4
  • NodeJS: 22.11.0 and 20.18.1

Additional context

to-kn avatar Dec 16 '24 14:12 to-kn

Could you share a reproduction on CodeSandbox or a failing test? Thanks

ardatan avatar Dec 16 '24 16:12 ardatan

hi @ardatan shure: https://github.com/to-kn/minimal-example-6776 npm i && npm run typecheck should give you the error

to-kn avatar Dec 16 '24 20:12 to-kn

Maybe it is the script you use internally. But I don't have get any errors with the latest typescript's tsc You can try it out here; https://codesandbox.io/p/github/to-kn/minimal-example-6776/csb-zpfs28/draft/cool-fog

ardatan avatar Dec 17 '24 09:12 ardatan

Hello @ardatan, I am experiencing the same issue. I was using "@graphql-tools/schema": "^10.0.7" and started encountering the following error when trying to build the application:

Screenshot 2024-12-17 at 11 44 25

I tried upgrading to "@graphql-tools/schema": "^10.0.13", but the error persists. In fact, I encounter the error regardless of whether I use version 10.0.7, 10.0.6, or 10.0.13.

I am not directly using the @graphql-tools/utils dependency, only the @graphql-tools/schema package.

I also tried the CodeSandbox mentioned in the previous comments, and the error can be observed there as well:

Screenshot 2024-12-17 at 11:54:12

gdguesser avatar Dec 17 '24 11:12 gdguesser

i found out, that kcd-scripts use internally typescript 4.9.5... If i downgrade typescript to 4.9.5 in my example, the error is also present with plain tsc. @gdguesser which version of typescript do you use?

to-kn avatar Dec 17 '24 12:12 to-kn

@to-kn You can force the package manager to use a certain TypeScript version. For example for yarn it is ;

"resolutions": {
  "typescript": "5.7.2"
}

Or you can enable skipLibCheck: true flag in tsconfig.json file

ardatan avatar Dec 17 '24 13:12 ardatan

@ardatan yes, thank you! I fixed it for us - feel free to close this issue! Maybe it would be useful to state somewhere, that from Version 10.6.4 onwards @graphql-tools/utils are not compatible with typescript V4 anymore?

to-kn avatar Dec 17 '24 13:12 to-kn