Skip to content

Commit 3195646

Browse files
fix(sql): Fix QueryResult typings (tauri-apps#1928)
* fix(sql): Fix QueryResult typings closes tauri-apps#1893 * Create fix-sql-queryresult-type.md --------- Co-authored-by: Tillmann <[email protected]>
1 parent 6f6a178 commit 3195646

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changes/fix-sql-queryresult-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
sql-js: patch
3+
---
4+
5+
Fixed the QueryResult typing by marking `lastInsertId` as optional to reflect postgres-only changes made in the 2.0.0 release.

plugins/sql/guest-js/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export interface QueryResult {
1010
/**
1111
* The last inserted `id`.
1212
*
13-
* This value is always `0` when using the Postgres driver. If the
13+
* This value is not set for Postgres databases. If the
1414
* last inserted id is required on Postgres, the `select` function
1515
* must be used, with a `RETURNING` clause
1616
* (`INSERT INTO todos (title) VALUES ($1) RETURNING id`).
1717
*/
18-
lastInsertId: number
18+
lastInsertId?: number
1919
}
2020

2121
/**

0 commit comments

Comments
 (0)