diff --git a/core/cursorHandler.ts b/core/cursorHandler.ts index efe5ff8..42975d9 100644 --- a/core/cursorHandler.ts +++ b/core/cursorHandler.ts @@ -1,9 +1,7 @@ import { ON_ERROR, ON_SUCCESS } from "./eventTypes.ts"; -export function cursorHandler( - request: IDBRequest | IDBRequest, - iterator: ( - cursor: IDBCursorWithValue, - ) => boolean | void | Promise, +export function cursorHandler( + request: IDBRequest, + iterator: (cursor: Cursor) => boolean | void | Promise, onEnd?: () => void, onError?: (reason?: unknown) => void, ): Promise { @@ -23,7 +21,7 @@ export function cursorHandler( // deno-lint-ignore no-explicit-any request[ON_SUCCESS] = async (event: any) => { - const cursor = event.target?.result as IDBCursorWithValue; + const cursor = event.target?.result as Cursor; if (cursor && !ended) { ended = await iterator?.(cursor) ?? false; if (ended === true) {