got icon indicating copy to clipboard operation
got copied to clipboard

quick-lru not a valid StorageAdapter

Open marcoreni opened this issue 3 years ago • 3 comments

Describe the bug

  • Node.js version: 14.16.0
  • OS & version: -

Actual behavior

It seems that since https://github.com/sindresorhus/quick-lru/releases/tag/v6.0.0 quick-lru is not compatible anymore with keyv:

    Type 'QuickLRU<unknown, unknown>' is not assignable to type 'string | false | StorageAdapter | undefined'.
      Type 'QuickLRU<unknown, unknown>' is not assignable to type 'StorageAdapter'.
        Types of property 'set' are incompatible.
          Type '(key: unknown, value: unknown, options?: { maxAge?: number | undefined; } | undefined) => QuickLRU<unknown, unknown>' is not assignable to type '(key: string, value: any, ttl?: number | undefined) => any'.
            Types of parameters 'options' and 'ttl' are incompatible.
              Type 'number | undefined' is not assignable to type '{ maxAge?: number | undefined; } | undefined'.
                Type 'number' is not assignable to type '{ maxAge?: number | undefined; } | undefined'.

Expected behavior

Either 1- Change signature of quicklru .set so that the metod is compliant with keyv StorageAdapter interface 2- Remove suggestion of quick-lru usage inside the readme

Checklist

  • [x] I have read the documentation.
  • [x] I have tried my code with the latest version of Node.js and Got.

marcoreni avatar Mar 08 '21 15:03 marcoreni

For now, we can update the readme to specify that v5 needs to be used.

I think the proper solution is to make keyv detect QuickLRU instance and pass the ttl correctly.

sindresorhus avatar Mar 09 '21 05:03 sindresorhus

Is this still an issue with https://github.com/microlinkhq/keyv? If not, why don’t we recommend it instead of keyv?

JaneJeon avatar Oct 08 '21 09:10 JaneJeon

For now, we can update the readme to specify that v5 needs to be used.

I think the proper solution is to make keyv detect QuickLRU instance and pass the ttl correctly.

Isn't it going to be handled? I mean, the version now is v14. Downgrade to v5 cannot be acceptable..

tal-rofe avatar Mar 07 '24 13:03 tal-rofe