Skip to content

Commit ced4dc7

Browse files
authored
fix(types): allow transaction to be null (#13093)
1 parent 365c23a commit ced4dc7

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

types/lib/model.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface Transactionable {
3535
/**
3636
* Transaction to run query under
3737
*/
38-
transaction?: Transaction;
38+
transaction?: Transaction | null;
3939
}
4040

4141
export interface SearchPathable {

types/test/transaction.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,9 @@ async function nestedTransact() {
7878
});
7979
await tr.commit();
8080
}
81+
82+
async function excludeFromTransaction() {
83+
await sequelize.transaction(async t =>
84+
await sequelize.query('SELECT 1', { transaction: null })
85+
);
86+
}

0 commit comments

Comments
 (0)