Skip to content

Commit 3ec0264

Browse files
committed
fix: correct TypeScript type casts for array operations in proxy
Cast through 'unknown' first when converting changeTracker.copy_ to Array<unknown> to satisfy TypeScript's type checking.
1 parent 17e4bd1 commit 3ec0264

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/db/src/proxy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ export function createChangeProxy<
510510
) {
511511
// Find the index of the result in the array
512512
const foundIndex = (
513-
changeTracker.copy_ as Array<unknown>
513+
changeTracker.copy_ as unknown as Array<unknown>
514514
).indexOf(result)
515515
if (foundIndex !== -1) {
516516
return getProxiedElement(result, foundIndex)
@@ -530,7 +530,7 @@ export function createChangeProxy<
530530
if (methodName === `filter`) {
531531
return result.map((element) => {
532532
const originalIndex = (
533-
changeTracker.copy_ as Array<unknown>
533+
changeTracker.copy_ as unknown as Array<unknown>
534534
).indexOf(element)
535535
if (originalIndex !== -1) {
536536
return getProxiedElement(element, originalIndex)
@@ -547,7 +547,7 @@ export function createChangeProxy<
547547
// Handle array Symbol.iterator for for...of loops
548548
if (prop === Symbol.iterator) {
549549
return function () {
550-
const array = changeTracker.copy_ as Array<unknown>
550+
const array = changeTracker.copy_ as unknown as Array<unknown>
551551
let index = 0
552552

553553
return {

0 commit comments

Comments
 (0)