diff --git a/types/bookshelf/bookshelf-tests.ts b/types/bookshelf/bookshelf-tests.ts index 75d91d73df..77af31461b 100644 --- a/types/bookshelf/bookshelf-tests.ts +++ b/types/bookshelf/bookshelf-tests.ts @@ -867,6 +867,10 @@ model.where('favorite_color', 'red').fetch().then(() => { model.where({favorite_color: 'red', shoe_size: 12}).fetch().then(() => { //... }); +// or +model.where('favorite_color', 'in', ['red', 'green']).fetch().then(() => { + // ... +}); /* Lodash methods, see http://bookshelfjs.org/#Model-subsection-lodash-methods */ @@ -1197,6 +1201,13 @@ ships.trigger('fetched'); /* collection.where(), see http://bookshelfjs.org/#Collection-instance-where */ +(new Author()) + .where('first_name', 'in', ['User', 'Resu']) + .fetchAll() + .then(() => { + // ... + }) + /* collection.withPivot(), see http://bookshelfjs.org/#Collection-instance-withPivot */ { diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index 0b22e60b69..bb817d3074 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -97,7 +97,7 @@ declare namespace Bookshelf { /** @deprecated should use `new` objects instead. */ static forge(attributes?: any, options?: ModelOptions): T; static where(properties: { [key: string]: any }): T; - static where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T; + static where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | string[] | number | number[] | boolean): T; belongsTo>(target: { new (...args: any[]): R }, foreignKey?: string, foreignKeyTarget?: string): R; belongsToMany>(target: { new (...args: any[]): R }, table?: string, foreignKey?: string, otherKey?: string, foreignKeyTarget?: string, otherKeyTarget?: string): Collection; @@ -126,7 +126,7 @@ declare namespace Bookshelf { save(attrs?: { [key: string]: any }, options?: SaveOptions): BlueBird; through>(interim: ModelSubclass, throughForeignKey?: string, otherKey?: string): R; where(properties: { [key: string]: any }): T; - where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T; + where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | string[] | number | number[] | boolean): T; // See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/errors.js // See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/model.js#L1280