From 94d111a94533c0c31231642e8ffe4fbd4ce30096 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 May 2017 18:27:50 +0200 Subject: lint for unused variables, fix query bug detected by this --- src/query.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/query.ts') diff --git a/src/query.ts b/src/query.ts index 805abd361..24db4de56 100644 --- a/src/query.ts +++ b/src/query.ts @@ -49,6 +49,7 @@ export class Store { } } + /** * Definition of an index. */ @@ -61,6 +62,13 @@ export class Index { constructor(s: Store, public indexName: string, public keyPath: string | string[]) { this.storeName = s.name; } + + /** + * We want to have the key type parameter in use somewhere, + * because otherwise the compiler complains. In iterIndex the + * key type is pretty useful. + */ + protected _dummyKey: S|undefined; } /** @@ -315,7 +323,6 @@ abstract class QueryStreamBase implements QueryStream, PromiseLike { type FilterFn = (e: any) => boolean; type SubscribeFn = (done: boolean, value: any, tx: IDBTransaction) => void; type SubscribeOneFn = (value: any, tx: IDBTransaction) => void; -type FlatMapFn = (v: T) => T[]; class QueryStreamFilter extends QueryStreamBase { constructor(public s: QueryStreamBase, public filterFn: FilterFn) { @@ -349,7 +356,7 @@ class QueryStreamFlatMap extends QueryStreamBase { } const values = this.flatMapFn(value); for (const v in values) { - f(false, value, tx); + f(false, v, tx); } }); } -- cgit v1.2.3