Compatibility with TS 5.6
Author: benasher44Created Oct 7, 2024Updated Nov 12, 2025
Describe the bug
The build fails compiling with TS 5.6:
node_modules/graphql-yoga/node_modules/lru-cache/dist/commonjs/index.d.ts:985:5 - error TS2416: Property 'keys' in type 'LRUCache<K, V, FC>' is not assignable to the same property in base type 'Map<K, V>'.
Type '() => Generator<K, void, unknown>' is not assignable to type '() => MapIterator<K>'.
Call signature return types 'Generator<K, void, unknown>' and 'MapIterator<K>' are incompatible.
The types returned by 'next(...)' are incompatible between these types.
Type 'IteratorResult<K, void>' is not assignable to type 'IteratorResult<K, undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorResult<K, undefined>'.
Type 'IteratorReturnResult<void>' is not assignable to type 'IteratorReturnResult<undefined>'.
Type 'void' is not assignable to type 'undefined'.
985 keys(): Generator<K, void, unknown>;Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
- Install graphql-yoga 5.x
- Run tsc with TS 5.6
Expected behavior
Compiles successfully
Screenshots or Videos
No response
Platform
- OS: macOS
- NodeJS: 20.12.2
@graphql-yoga/*version(s): 5.6.1
Additional context
lru-cache v10.x doesn't seem to be compatible with TS 5.6, but lru-cache v11 seems to be fine. Upgrading would require dropping support for node less 20 though, so this would require graphql-yoga to go to v6. Maybe it's time?
Source: graphql-hive/graphql-yoga