Skip to content

Commit

Permalink
feat(ts): add generic to Cache type
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Feb 9, 2024
1 parent 0ca64fc commit 07640f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export type Eventually<Value> =
| undefined
| Promise<Value | null | undefined>;

export interface Cache {
export interface Cache<Value = unknown> {
name?: string;
get: (key: string) => Eventually<CacheEntry<unknown>>;
set: (key: string, value: CacheEntry<unknown>) => unknown | Promise<unknown>;
delete: (key: string) => unknown | Promise<unknown>;
get: (key: string) => Eventually<CacheEntry<Value>>;
set: (key: string, value: CacheEntry<Value>) => Value | Promise<Value>;
delete: (key: string) => Value | Promise<Value>;
}

export interface GetFreshValueContext {
Expand Down

0 comments on commit 07640f3

Please sign in to comment.