Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with TS 5.6 #3442

Open
benasher44 opened this issue Oct 7, 2024 · 2 comments
Open

Compatibility with TS 5.6 #3442

benasher44 opened this issue Oct 7, 2024 · 2 comments

Comments

@benasher44
Copy link

benasher44 commented Oct 7, 2024

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

  1. Install graphql-yoga 5.x
  2. 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?

@tplorts
Copy link

tplorts commented Oct 31, 2024

we can get our project to compile by adding this to our tsconfig

"strictBuiltinIteratorReturn": false,

but would prefer to keep that setting enabled if possible.

@sstoneloveall
Copy link

Same issue. The tsconfig setting "strictBuiltinIteratorReturn": false prevents the error, but it would be nice to keep it enabled. FYI isaacs/node-lru-cache#354 lru cache issue has been recently fixed in the source library so hopefully the dependency can be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants