diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 701a735f14..dc8614cb68 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3187,8 +3187,9 @@ declare namespace sequelize { * We did put Object in the end, because there where query might be a JSON Blob. It cripples a bit the * typesafety, but there is no way to pass the tests if we just remove it. */ + type Primitives = string | number | boolean | Buffer; type WhereOptions = { - [P in keyof T]?: string | number | boolean | WhereLogic | WhereOptions | col | and | or | WhereGeometryOptions | WhereNested | Array | null; + [P in keyof T]?: Primitives | Array | WhereLogic | (T[P] extends Primitives ? null : WhereOptions) | col | and | or | WhereGeometryOptions | WhereNested | null; }; /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index e2954e3637..bc0aa7d51d 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -922,6 +922,9 @@ User.findAll( { include : [{ model : Task, paranoid: false }] } ); User.findAll( { transaction : t } ); User.findAll( { where : { data : { name : { last : 's' }, employment : { $ne : 'a' } } }, order : [['id', 'ASC']] } ); User.findAll( { where : { username : ['boo', 'boo2'] } } ); +User.findAll( { where : { username : Buffer.from("a name") } } ); +User.findAll( { where : { username : [Buffer.from("a name")] } } ); +User.findAll( { where : { username : [true] } } ); User.findAll( { where : { username : { like : '%2' } } } ); User.findAll( { where : { theDate : { '..' : ['2013-01-02', '2013-01-11'] } } } ); User.findAll( { where : { intVal : { '!..' : [8, 10] } } } );