Skip to content

Commit 344343f

Browse files
committed
fix for eslint
1 parent 7aca9e7 commit 344343f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

packages/db/src/collection/change-events.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import {
33
toExpression,
44
} from "../query/builder/ref-proxy"
55
import { compileSingleRowExpression } from "../query/compiler/evaluators.js"
6-
import { optimizeExpressionWithIndexes, findIndexForField } from "../utils/index-optimization.js"
6+
import {
7+
findIndexForField,
8+
optimizeExpressionWithIndexes,
9+
} from "../utils/index-optimization.js"
710
import { ensureIndexForField } from "../indexes/auto-index.js"
811
import { makeComparator } from "../utils/comparison.js"
912
import type {
@@ -13,7 +16,7 @@ import type {
1316
} from "../types"
1417
import type { Collection, CollectionImpl } from "./index.js"
1518
import type { SingleRowRefProxy } from "../query/builder/ref-proxy"
16-
import type { BasicExpression, OrderBy, PropRef } from "../query/ir.js"
19+
import type { BasicExpression, OrderBy } from "../query/ir.js"
1720

1821
/**
1922
* Interface for a collection-like object that provides the necessary methods
@@ -40,15 +43,15 @@ function getOrderedKeys<T extends object, TKey extends string | number>(
4043
orderBy: OrderBy,
4144
limit?: number,
4245
whereFilter?: (item: T) => boolean,
43-
optimizedOnly?: boolean,
46+
optimizedOnly?: boolean
4447
): Array<TKey> | undefined {
4548
// For single-column orderBy on a ref expression, try index optimization
4649
if (orderBy.length === 1) {
4750
const clause = orderBy[0]!
4851
const orderByExpression = clause.expression
4952

5053
if (orderByExpression.type === `ref`) {
51-
const propRef = orderByExpression as PropRef
54+
const propRef = orderByExpression
5255
const fieldPath = propRef.path
5356

5457
// Ensure index exists for this field
@@ -79,11 +82,7 @@ function getOrderedKeys<T extends object, TKey extends string | number>(
7982
// Take the keys that match the filter and limit
8083
// if no limit is provided `index.keyCount` is used,
8184
// i.e. we will take all keys that match the filter
82-
return index.take(
83-
limit ?? index.keyCount,
84-
undefined,
85-
filterFn
86-
) as Array<TKey>
85+
return index.take(limit ?? index.keyCount, undefined, filterFn)
8786
}
8887
}
8988
}
@@ -134,7 +133,7 @@ function getOrderedKeys<T extends object, TKey extends string | number>(
134133
*/
135134
function extractValueFromItem(item: any, expression: BasicExpression): any {
136135
if (expression.type === `ref`) {
137-
const propRef = expression as PropRef
136+
const propRef = expression
138137
let value = item
139138
for (const pathPart of propRef.path) {
140139
value = value?.[pathPart]
@@ -223,7 +222,7 @@ export function currentStateAsChanges<
223222
options.orderBy,
224223
options.limit,
225224
whereFilter,
226-
options.optimizedOnly,
225+
options.optimizedOnly
227226
)
228227

229228
if (orderedKeys === undefined) {

packages/db/tests/collection-change-events.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ describe(`currentStateAsChanges`, () => {
374374
})
375375

376376
describe(`edge cases`, () => {
377-
it(`should handle empty collection`, async () => {
377+
it(`should handle empty collection`, () => {
378378
const collection = createCollection<TestUser>({
379379
id: `test-collection-empty-${autoIndex}`,
380380
getKey: (user) => user.id,

0 commit comments

Comments
 (0)