diff --git a/src/storage/archive/db/index.ts b/src/storage/archive/db/index.ts index ee24d32b7b..f554d5f5c0 100644 --- a/src/storage/archive/db/index.ts +++ b/src/storage/archive/db/index.ts @@ -6,16 +6,16 @@ export function create({id}: {id: string}): DB { const store = new MMKV({id}) return { - async get(key: string): Promise { + get(key: string) { return store.getString(key) }, - async set(key: string, value: string): Promise { + set(key: string, value: string) { return store.set(key, value) }, - async delete(key: string): Promise { + delete(key: string) { return store.delete(key) }, - async clear(): Promise { + clear() { return store.clearAll() }, } diff --git a/src/storage/archive/db/index.web.ts b/src/storage/archive/db/index.web.ts index c8d5095b1c..d36d36eec6 100644 --- a/src/storage/archive/db/index.web.ts +++ b/src/storage/archive/db/index.web.ts @@ -6,16 +6,16 @@ export function create({id}: {id: string}): DB { const store = createStore(id, id) return { - async get(key: string): Promise { + get(key: string) { return get(key, store) }, - async set(key: string, value: string): Promise { + set(key: string, value: string) { return set(key, value, store) }, - async delete(key: string): Promise { + delete(key: string) { return del(key, store) }, - async clear(): Promise { + clear() { return clear(store) }, } diff --git a/src/storage/archive/db/types.ts b/src/storage/archive/db/types.ts index 4582dfab61..388b2b8035 100644 --- a/src/storage/archive/db/types.ts +++ b/src/storage/archive/db/types.ts @@ -1,6 +1,7 @@ +type MaybePromise = T | Promise export type DB = { - get(key: string): Promise - set(key: string, value: string): Promise - delete(key: string): Promise - clear(): Promise + get(key: string): MaybePromise + set(key: string, value: string): MaybePromise + delete(key: string): MaybePromise + clear(): MaybePromise }