Type Alias HasManyAddAssociationMixin<T, TModelPrimaryKey>

HasManyAddAssociationMixin: (
    newAssociation?: T | TModelPrimaryKey,
    options?: HasManyAddAssociationMixinOptions<T>,
) => Promise<void>

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

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

User.hasMany(Role);

Type Parameters

  • T extends Model
  • TModelPrimaryKey

Type declaration

Model.hasMany