Skip to content

Commit b6d6787

Browse files
Evgeniysushantdhiman
authored andcommitted
fix(types): add literal to possible where options (#10990)
1 parent f2b0aec commit b6d6787

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

types/lib/model.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export interface ScopeOptions {
121121
/**
122122
* The type accepted by every `where` option
123123
*/
124-
export type WhereOptions = WhereAttributeHash | AndOperator | OrOperator | Where;
124+
export type WhereOptions = WhereAttributeHash | AndOperator | OrOperator | Literal | Where;
125125

126126
/**
127127
* Example: `[Op.any]: [2,3]` becomes `ANY ARRAY[2, 3]::INTEGER`

types/test/where.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AndOperator, fn, Model, Op, OrOperator, Sequelize, WhereOperators, WhereOptions, where as whereFn } from 'sequelize';
1+
import { AndOperator, fn, Model, Op, OrOperator, Sequelize, WhereOperators, WhereOptions, literal, where as whereFn } from 'sequelize';
22
import Transaction from '../lib/transaction';
33

44
class MyModel extends Model {
@@ -266,6 +266,13 @@ where = whereFn('test', {
266266
[Op.gt]: new Date(),
267267
});
268268

269+
// Literal as where
270+
where = literal('true')
271+
272+
MyModel.findAll({
273+
where: literal('true')
274+
})
275+
269276
// Where as having option
270277
MyModel.findAll({
271278
having: where

0 commit comments

Comments
 (0)