Type alias BelongsToSetAssociationMixin<T, TargetKeyType>

BelongsToSetAssociationMixin<T, TargetKeyType>: ((newAssociation?: T | TargetKeyType, options?: BelongsToSetAssociationMixinOptions<T>) => Promise<void>)

Type Parameters

  • T extends Model

  • TargetKeyType

    The type of the attribute that the foreign key references.

Type declaration

    • (newAssociation?: T | TargetKeyType, options?: BelongsToSetAssociationMixinOptions<T>): Promise<void>
    • The setAssociation mixin applied to models with belongsTo. An example of usage is as follows:

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

      User.belongsTo(Role);

      See

      Model.belongsTo

      Parameters

      Returns Promise<void>

Generated using TypeDoc