use generics here to say return type of method is same as callback

This commit is contained in:
Bruno Windels 2021-09-06 13:01:32 +02:00
parent 5b9fd5de94
commit 36da02c14e

View file

@ -57,7 +57,7 @@ export class Transaction {
return new Store(this._txn.objectStore(name), this);
}
_store(name: StoreNames, mapStore: (idbStore: Store<any>) => any): any {
_store<T>(name: StoreNames, mapStore: (idbStore: Store<any>) => T): T {
if (!this._stores[name]) {
const idbStore = this._idbStore(name);
this._stores[name] = mapStore(idbStore);