Merge pull request #33761 from haracejacob/sequelize/whereoption

[@types/sequelize] Add where type to WhereOptions
This commit is contained in:
Sheetal Nandi
2019-03-18 13:02:28 -07:00
committed by GitHub
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -3198,7 +3198,7 @@ declare namespace sequelize {
*/
type Primitives = string | number | boolean | Buffer;
type WhereOptions<T> = {
[P in keyof T]?: Primitives | Array<Primitives> | WhereLogic | (T[P] extends Primitives ? null : WhereOptions<T[P]>) | col | and | or | WhereGeometryOptions | WhereNested | null;
[P in keyof T]?: Primitives | Array<Primitives> | WhereLogic | (T[P] extends Primitives ? null : WhereOptions<T[P]>) | col | and | or | WhereGeometryOptions | WhereNested | where | null;
};
/**
+3
View File
@@ -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') );