@graphql-tools/utils 10.6.4 not compatible to Typescript >= V5
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 generatein the terminal.Please make sure the GraphQL Tools package versions under
package.jsonmatches 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
Could you share a reproduction on CodeSandbox or a failing test? Thanks
hi @ardatan shure: https://github.com/to-kn/minimal-example-6776 npm i && npm run typecheck should give you the error
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
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:
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:
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 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 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?