1
0
Fork 0
mirror of synced 2024-10-01 09:38:55 +13:00

Fixing typing for performCall.

This commit is contained in:
mike12345567 2024-01-11 17:17:38 +00:00
parent 8483a53178
commit e69ba75849

View file

@ -33,7 +33,7 @@ function buildNano(couchInfo: { url: string; cookie: string }) {
})
}
type DBCall = () => Promise<any>
type DBCall<T> = () => Promise<T>
export function DatabaseWithConnection(
dbName: string,
@ -107,8 +107,8 @@ export class DatabaseImpl implements Database {
}
// this function fetches the DB and handles if DB creation is needed
private async performCall(
call: (db: Nano.DocumentScope<any>) => Promise<DBCall> | DBCall
private async performCall<T>(
call: (db: Nano.DocumentScope<any>) => Promise<DBCall<T>> | DBCall<T>
): Promise<any> {
const db = this.getDb()
const fnc = await call(db)