Skip to content

Commit d5c09c9

Browse files
committed
Fix type issue.
1 parent 73eecf2 commit d5c09c9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/web/src/shared/open-db.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function _openDB(
4444
* This requests a lock for executing statements.
4545
* Should only be used internally.
4646
*/
47-
const _acquireExecuteLock = (callback: () => Promise<any>): Promise<any> => {
47+
const _acquireExecuteLock = <T>(callback: () => Promise<T>): Promise<T> => {
4848
return statementMutex.runExclusive(callback);
4949
};
5050

@@ -117,7 +117,7 @@ export async function _openDB(
117117
* This executes SQL statements in a batch.
118118
*/
119119
const executeBatch = async (sql: string, bindings?: any[][]): Promise<WASQLExecuteResult> => {
120-
return _acquireExecuteLock(async () => {
120+
return _acquireExecuteLock(async (): Promise<WASQLExecuteResult> => {
121121
let affectedRows = 0;
122122

123123
const str = sqlite3.str_new(db, sql);
@@ -129,7 +129,8 @@ export async function _openDB(
129129
const prepared = await sqlite3.prepare_v2(db, query);
130130
if (prepared === null) {
131131
return {
132-
rowsAffected: 0
132+
rowsAffected: 0,
133+
rows: { _array: [], length: 0 }
133134
};
134135
}
135136
const wrappedBindings = bindings ? bindings : [];
@@ -160,13 +161,15 @@ export async function _openDB(
160161
} catch (err) {
161162
await executeSingleStatement('ROLLBACK');
162163
return {
163-
rowsAffected: 0
164+
rowsAffected: 0,
165+
rows: { _array: [], length: 0 }
164166
};
165167
} finally {
166168
sqlite3.str_finish(str);
167169
}
168170
const result = {
169-
rowsAffected: affectedRows
171+
rowsAffected: affectedRows,
172+
rows: { _array: [], length: 0 }
170173
};
171174

172175
return result;

0 commit comments

Comments
 (0)