不要怂,就是干,撸起袖子干!

Commit 032d9968 by Chocobozzz Committed by Sushant

fix(types): scope typing (#10803)

1 parent 39269912
......@@ -1655,7 +1655,7 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
*/
public static scope<M extends { new (): Model }>(
this: M,
options?: string | string[] | ScopeOptions | WhereAttributeHash
options?: string | ScopeOptions | (string | ScopeOptions)[] | WhereAttributeHash
): M;
public static addScope(name: string, scope: FindOptions, options?: AddScopeOptions): void;
......
......@@ -55,6 +55,9 @@ User.init(
firstName: a,
},
};
},
custom2() {
return {}
}
},
sequelize,
......@@ -79,3 +82,8 @@ export const Group = User.belongsTo(UserGroup, { as: 'group', foreignKey: 'group
// associations refer to their Model
const userType: ModelCtor<User> = User.associations.group.source;
const groupType: ModelCtor<UserGroup> = User.associations.group.target;
User.scope([
'custom2',
{ method: [ 'custom', 32 ] }
])
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!