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

TS error when using QuickLRU from readme example #51

Open
studentIvan opened this issue Nov 25, 2021 · 5 comments
Open

TS error when using QuickLRU from readme example #51

studentIvan opened this issue Nov 25, 2021 · 5 comments

Comments

@studentIvan
Copy link

export const cacheable = new CacheableLookup({
  cache: new QuickLRU({ maxSize: 1000 }),
});
Type 'QuickLRU<string, EntryObject[] | Promise<EntryObject[] | undefined>>' is not assignable to type 'CacheInstance'.
  Types of property 'set' are incompatible.
    Type '(key: string, value: EntryObject[] | Promise<EntryObject[] | undefined>, options?: { maxAge?: number | undefined; } | undefined) => QuickLRU<string, EntryObject[] | Promise<...>>' is not assignable to type '(hostname: string, entries: EntryObject[], ttl: number) => TPromise<boolean | void | CacheInstance>'.
      Types of parameters 'options' and 'ttl' are incompatible.
        Type 'number' is not assignable to type '{ maxAge?: number | undefined; } | undefined'.ts(2322)
@renatomariscal
Copy link

What version of the libraries are you using? cacheable-lookup, quick-lru and typescript

@szmarczak
Copy link
Owner

Good catch!

set(hostname: string, entries: EntryObject[], ttl: number): TPromise<void | boolean | this>;

	set(hostname: string, entries: EntryObject[], ttl: number): TPromise<void | boolean | this>;
+	set(hostname: string, entries: EntryObject[]): TPromise<void | boolean | this>;

I think this should work. Not tested yet.

@viceice
Copy link

viceice commented Aug 31, 2022

seeing same error:
image
image

@viceice
Copy link

viceice commented Aug 31, 2022

ok downgrade to v5 of both fixed the issue and is compatible with got v11

@dontbesatisfied
Copy link

dontbesatisfied commented Jan 8, 2023

i'm using 7.0.0 but it now fixed and 5.0.4 does not work.

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

5 participants