diff --git a/.changes/fix-sql-queryresult-type.md b/.changes/fix-sql-queryresult-type.md new file mode 100644 index 000000000..f93f741c6 --- /dev/null +++ b/.changes/fix-sql-queryresult-type.md @@ -0,0 +1,5 @@ +--- +sql-js: patch +--- + +Fixed the QueryResult typing by marking `lastInsertId` as optional to reflect postgres-only changes made in the 2.0.0 release. diff --git a/plugins/sql/guest-js/index.ts b/plugins/sql/guest-js/index.ts index 05eed0e3a..74f6dc7ba 100644 --- a/plugins/sql/guest-js/index.ts +++ b/plugins/sql/guest-js/index.ts @@ -10,12 +10,12 @@ export interface QueryResult { /** * The last inserted `id`. * - * This value is always `0` when using the Postgres driver. If the + * This value is not set for Postgres databases. If the * last inserted id is required on Postgres, the `select` function * must be used, with a `RETURNING` clause * (`INSERT INTO todos (title) VALUES ($1) RETURNING id`). */ - lastInsertId: number + lastInsertId?: number } /**