From 4c4687a05f85768b3b1118b9c8c85c44aca0c7a1 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 27 Aug 2021 09:29:02 -0700 Subject: [PATCH] Avoid unsafe (and error-prone) cast --- src/matrix/storage/idb/Store.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/matrix/storage/idb/Store.ts b/src/matrix/storage/idb/Store.ts index 64943d1b..8063a4c8 100644 --- a/src/matrix/storage/idb/Store.ts +++ b/src/matrix/storage/idb/Store.ts @@ -35,15 +35,14 @@ class QueryTargetWrapper { } get keyPath(): string | string[] { - if ("objectStore" in this._qt) { - return this._qt.objectStore.keyPath; - } else { - return this._qt.keyPath; - } + return this._qtStore.keyPath; } get _qtStore(): IDBObjectStore { - return this._qt as IDBObjectStore; + if ("objectStore" in this._qt) { + return this._qt.objectStore; + } + return this._qt; } supports(methodName: string): boolean {