Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
type MapLike<K, V> = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋🏾 from Web Systems - bumping this comment #25 (comment)

set(key: K, value: V): void
get(key: K): V | undefined
has(key: K): boolean
delete(key: K): void
}

export interface MemoizeOptions<A extends unknown[], R, H = unknown> {
/**
* Provides a single value to use as the Key for the memoization.
Expand All @@ -9,7 +16,7 @@ export interface MemoizeOptions<A extends unknown[], R, H = unknown> {
* The Cache implementation to provide. Must be a Map or Map-alike.
* Defaults to a Map. Useful for replacing the cache with an LRU cache or similar.
*/
cache?: Map<H, R>
cache?: MapLike<H, R>
}

export type MemoizableFunction<A extends unknown[], R extends unknown, T extends unknown> = (this: T, ...args: A) => R
Expand Down