From d6b981b2540afe3aa3ee08b64da91f6e83fa898d Mon Sep 17 00:00:00 2001 From: Sam Willis Date: Wed, 15 Jan 2025 17:42:26 +0000 Subject: [PATCH] fix: incorrect return type for the .transaction method (#497) --- .changeset/late-forks-joke.md | 5 +++++ packages/pglite/src/base.ts | 4 +--- packages/pglite/src/interface.ts | 4 +--- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 .changeset/late-forks-joke.md diff --git a/.changeset/late-forks-joke.md b/.changeset/late-forks-joke.md new file mode 100644 index 000000000..19584a30d --- /dev/null +++ b/.changeset/late-forks-joke.md @@ -0,0 +1,5 @@ +--- +'@electric-sql/pglite': patch +--- + +Fix the return type of the `.transaction` method diff --git a/packages/pglite/src/base.ts b/packages/pglite/src/base.ts index 2dad07a20..84deb02b2 100644 --- a/packages/pglite/src/base.ts +++ b/packages/pglite/src/base.ts @@ -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( - callback: (tx: Transaction) => Promise, - ): Promise { + async transaction(callback: (tx: Transaction) => Promise): Promise { await this._checkReady() return await this._runExclusiveTransaction(async () => { await this.#runExec('BEGIN') diff --git a/packages/pglite/src/interface.ts b/packages/pglite/src/interface.ts index 428d9d537..9194fa6c9 100644 --- a/packages/pglite/src/interface.ts +++ b/packages/pglite/src/interface.ts @@ -112,9 +112,7 @@ export type PGliteInterface = ): Promise> exec(query: string, options?: QueryOptions): Promise> describeQuery(query: string): Promise - transaction( - callback: (tx: Transaction) => Promise, - ): Promise + transaction(callback: (tx: Transaction) => Promise): Promise execProtocolRaw( message: Uint8Array, options?: ExecProtocolOptions,