mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
[sequelize] Add explanation for Model.associate? method
This commit is contained in:
Vendored
+9
@@ -4085,6 +4085,15 @@ declare namespace sequelize {
|
||||
/**
|
||||
* Set associations with other models
|
||||
*
|
||||
* Not part of the sequelize API, used as convention to associate models after creation. e.g.:
|
||||
* ```js
|
||||
* Object.keys(models).forEach(modelName => {
|
||||
* if (models[modelName].associate) {
|
||||
* models[modelName].associate(models);
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param models
|
||||
*/
|
||||
associate?(models: Models): void;
|
||||
|
||||
@@ -1523,6 +1523,13 @@ s.define( 'ScopeMe', {
|
||||
}
|
||||
} );
|
||||
|
||||
// Test convention method used to associate models after creation
|
||||
Object.keys(s.models).forEach(modelName => {
|
||||
if (s.models[modelName].associate) {
|
||||
s.models[modelName].associate(s.models);
|
||||
}
|
||||
});
|
||||
|
||||
// Generic find options
|
||||
interface ChairAttributes {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user