cacheable-lookup
cacheable-lookup copied to clipboard
TS error when using QuickLRU from readme example
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)
What version of the libraries are you using? cacheable-lookup, quick-lru and typescript
Good catch!
https://github.com/szmarczak/cacheable-lookup/blob/45b18daf9f0c8406691fad81188e956641e2309d/index.d.ts#L11
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.
seeing same error:
ok downgrade to v5 of both fixed the issue and is compatible with got v11
i'm using 7.0.0 but it now fixed and 5.0.4 does not work.