不要怂,就是干,撸起袖子干!

Commit 97ba2422 by Emilio Cristalli Committed by GitHub

fix(types): allow `(keyof TAttributes)[]` in `UpdateOptions.returning` (#13130)

1 parent 023e1d9a
Showing with 19 additions and 1 deletions
...@@ -875,7 +875,7 @@ export interface UpdateOptions<TAttributes = any> extends Logging, Transactionab ...@@ -875,7 +875,7 @@ export interface UpdateOptions<TAttributes = any> extends Logging, Transactionab
/** /**
* Return the affected rows (only for postgres) * Return the affected rows (only for postgres)
*/ */
returning?: boolean; returning?: boolean | (keyof TAttributes)[];
/** /**
* How many rows to update (only for mysql and mariadb) * How many rows to update (only for mysql and mariadb)
......
import { Model } from 'sequelize';
import { User } from './models/User';
class TestModel extends Model {
}
TestModel.update({}, { where: {} });
TestModel.update({}, { where: {}, returning: false });
TestModel.update({}, { where: {}, returning: true });
TestModel.update({}, { where: {}, returning: ['foo'] });
User.update({}, { where: {} });
User.update({}, { where: {}, returning: true });
User.update({}, { where: {}, returning: false });
User.update({}, { where: {}, returning: ['username'] });
// @ts-expect-error
User.update({}, { where: {}, returning: ['foo'] });
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!