Skip to content

Commit dc25ef3

Browse files
committed
fix: transaction rollback result
1 parent f867ac4 commit dc25ef3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package/src/operations/transaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ export const transaction = async <Result = void>(
8484
}
8585

8686
try {
87-
return rollback()
87+
rollback()
88+
return undefined as Result
8889
} catch (rollbackError) {
8990
throw NitroSQLiteError.fromError(rollbackError)
9091
}

package/src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export interface NitroSQLiteConnection {
88
delete(): void
99
attach(dbNameToAttach: string, alias: string, location?: string): void
1010
detach(alias: string): void
11-
transaction(fn: (tx: Transaction) => Promise<void> | void): Promise<void>
11+
transaction<Result = void>(
12+
fn: (tx: Transaction) => Promise<Result>,
13+
): Promise<Result>
1214
execute: ExecuteQuery
1315
executeAsync: ExecuteAsyncQuery
1416
executeBatch(commands: BatchQueryCommand[]): BatchQueryResult

0 commit comments

Comments
 (0)