diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 73e3f3c222..23f620d8ba 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3198,7 +3198,7 @@ declare namespace sequelize { */ type Primitives = string | number | boolean | Buffer; type WhereOptions = { - [P in keyof T]?: Primitives | Array | WhereLogic | (T[P] extends Primitives ? null : WhereOptions) | col | and | or | WhereGeometryOptions | WhereNested | null; + [P in keyof T]?: Primitives | Array | WhereLogic | (T[P] extends Primitives ? null : WhereOptions) | col | and | or | WhereGeometryOptions | WhereNested | where | null; }; /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 588b3728d2..520eb8a724 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -997,6 +997,9 @@ User.findAll( { where: { $and:[ { username: { $not: "user" } }, { theDate: new D User.findAll( { where: { $or:[ { username: { $not: "user" } }, { theDate: new Date() } ] } } ); User.findAll( { where: { emails: { $overlap: ["me@mail.com", "you@mail.com"] } } } ); +var options: Sequelize.AnyFindOptions = { where: { $and: Sequelize.where( Sequelize.fn( 'char_length', Sequelize.col('username') ), 4 ) } }; +User.findAll( options ); + User.findById( 'a string' ); User.findById( 42 ); User.findById( Buffer.from('a buffer') );