mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-06-18 20:30:15 +00:00
Improve typings
Remove `DEV` blocks
This commit is contained in:
@@ -28,7 +28,7 @@ export async function OpenKeyValueDatabase(dbKey: string): Promise<KeyValueDatab
|
||||
}
|
||||
|
||||
export class IDBKeyValueDatabase implements KeyValueDatabase {
|
||||
protected _dbPromise: Promise<IDBPDatabase<any>> | null = null;
|
||||
protected _dbPromise: Promise<IDBPDatabase<unknown>> | null = null;
|
||||
protected dbKey: string;
|
||||
protected storeKey: string;
|
||||
protected _isDestroyed: boolean = false;
|
||||
@@ -104,7 +104,7 @@ export class IDBKeyValueDatabase implements KeyValueDatabase {
|
||||
this.destroyedPromise = Promise.resolve();
|
||||
}
|
||||
}
|
||||
get DB(): Promise<IDBPDatabase<any>> {
|
||||
get DB(): Promise<IDBPDatabase<unknown>> {
|
||||
if (this._isDestroyed) {
|
||||
return Promise.reject(new Error("Database is destroyed"));
|
||||
}
|
||||
@@ -117,7 +117,7 @@ export class IDBKeyValueDatabase implements KeyValueDatabase {
|
||||
}
|
||||
async get<U>(key: IDBValidKey): Promise<U> {
|
||||
const db = await this.DB;
|
||||
return await db.get(this.storeKey, key);
|
||||
return (await db.get(this.storeKey, key)) as U;
|
||||
}
|
||||
async set<U>(key: IDBValidKey, value: U): Promise<IDBValidKey> {
|
||||
const db = await this.DB;
|
||||
|
||||
Reference in New Issue
Block a user