Skip to content

Commit

Permalink
fix: incorrect return type for the .transaction method (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
samwillis authored Jan 15, 2025
1 parent ddd4a68 commit d6b981b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-forks-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@electric-sql/pglite': patch
---

Fix the return type of the `.transaction` method
4 changes: 1 addition & 3 deletions packages/pglite/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ export abstract class BasePGlite
* @param callback A callback function that takes a transaction object
* @returns The result of the transaction
*/
async transaction<T>(
callback: (tx: Transaction) => Promise<T>,
): Promise<T | undefined> {
async transaction<T>(callback: (tx: Transaction) => Promise<T>): Promise<T> {
await this._checkReady()
return await this._runExclusiveTransaction(async () => {
await this.#runExec('BEGIN')
Expand Down
4 changes: 1 addition & 3 deletions packages/pglite/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ export type PGliteInterface<T extends Extensions = Extensions> =
): Promise<Results<T>>
exec(query: string, options?: QueryOptions): Promise<Array<Results>>
describeQuery(query: string): Promise<DescribeQueryResult>
transaction<T>(
callback: (tx: Transaction) => Promise<T>,
): Promise<T | undefined>
transaction<T>(callback: (tx: Transaction) => Promise<T>): Promise<T>
execProtocolRaw(
message: Uint8Array,
options?: ExecProtocolOptions,
Expand Down

0 comments on commit d6b981b

Please sign in to comment.