mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Changing 'scope' definition (#14810)
current definition ```ts scope(options?: string | string[] | ScopeOptions | WhereOptions): this; ``` doesn't allow are valid calls. example from [documentation](http://docs.sequelizejs.com/en/latest/docs/scopes/): ```ts Project.scope('random', { method: ['accessLevel', 19]}).findAll(); ``` changing it to ```ts scope(options?: string | ScopeOptions | WhereOptions | Array<string|ScopeOptions|WhereOptions>): this; ``` should fix the issue since, according to the docs ```ts // These two are equivalent Project.scope('deleted', 'activeUsers').findAll(); Project.scope(['deleted', 'activeUsers']).findAll(); ```
This commit is contained in:
committed by
Mohamed Hegazy
parent
12b1792ca0
commit
75ffb8e47d
2
sequelize/index.d.ts
vendored
2
sequelize/index.d.ts
vendored
@@ -3671,7 +3671,7 @@ declare namespace sequelize {
|
||||
* @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned
|
||||
* model will clear the previous scope.
|
||||
*/
|
||||
scope(options?: string | string[] | ScopeOptions | WhereOptions): this;
|
||||
scope(options?: string | ScopeOptions | WhereOptions | Array<string | ScopeOptions | WhereOptions>): this;
|
||||
|
||||
/**
|
||||
* Search for multiple instances.
|
||||
|
||||
@@ -853,11 +853,14 @@ User.schema( 'special' ).create( { age : 3 }, { logging : function( ) {} } );
|
||||
User.getTableName();
|
||||
|
||||
User.addScope('lowAccess', { where : { parent_id : 2 } });
|
||||
User.addScope('lowAccess', function() { } );
|
||||
User.addScope('lowAccess', { where : { parent_id : 2 } }, { override: true });
|
||||
User.addScope('lowAccessWithParam', function(id: number) {
|
||||
return { where : { parent_id : id } }
|
||||
} );
|
||||
|
||||
User.scope( 'lowAccess' ).count();
|
||||
User.scope( { where : { parent_id : 2 } } );
|
||||
User.scope( [ 'lowAccess', { method: ['lowAccessWithParam', 2] }, { where : { parent_id : 2 } } ] )
|
||||
|
||||
User.findAll();
|
||||
User.findAll( { where : { data : { employment : null } } } );
|
||||
|
||||
2
sequelize/v3/index.d.ts
vendored
2
sequelize/v3/index.d.ts
vendored
@@ -3648,7 +3648,7 @@ declare namespace sequelize {
|
||||
* @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned
|
||||
* model will clear the previous scope.
|
||||
*/
|
||||
scope(options?: string | string[] | ScopeOptions | WhereOptions): this;
|
||||
scope(options?: string | ScopeOptions | WhereOptions | Array<string | ScopeOptions | WhereOptions>): this;
|
||||
|
||||
/**
|
||||
* Search for multiple instances.
|
||||
|
||||
@@ -840,11 +840,14 @@ User.schema( 'special' ).create( { age : 3 }, { logging : function( ) {} } );
|
||||
User.getTableName();
|
||||
|
||||
User.addScope('lowAccess', { where : { parent_id : 2 } });
|
||||
User.addScope('lowAccess', function() { } );
|
||||
User.addScope('lowAccess', { where : { parent_id : 2 } }, { override: true });
|
||||
User.addScope('lowAccessWithParam', function(id: number) {
|
||||
return { where : { parent_id : id } }
|
||||
} );
|
||||
|
||||
User.scope( 'lowAccess' ).count();
|
||||
User.scope( { where : { parent_id : 2 } } );
|
||||
User.scope( [ 'lowAccess', { method: ['lowAccessWithParam', 2] }, { where : { parent_id : 2 } } ] )
|
||||
|
||||
User.findAll();
|
||||
User.findAll( { where : { data : { employment : null } } } );
|
||||
|
||||
Reference in New Issue
Block a user