Type Alias BelongsToManyAddAssociationMixin<T, TModelPrimaryKey>

BelongsToManyAddAssociationMixin: (
    newAssociation?: T | TModelPrimaryKey,
    options?: BelongsToManyAddAssociationMixinOptions<T>,
) => Promise<void>

The addAssociation mixin applied to models with belongsToMany. An example of usage is as follows:

class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
declare addRole: BelongsToManyAddAssociationMixin<Role, Role['id']>;
}

User.belongsToMany(Role, { through: UserRole });

Type Parameters

  • T extends Model
  • TModelPrimaryKey

Type declaration

Model.belongsToMany