Type alias HasOneGetAssociationMixin<T>

HasOneGetAssociationMixin<T>: ((options?: HasOneGetAssociationMixinOptions<T>) => Promise<T | null>)

Type Parameters

Type declaration

    • (options?: HasOneGetAssociationMixinOptions<T>): Promise<T | null>
    • The getAssociation mixin applied to models with hasOne. An example of usage is as follows:

      class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
      declare getRole: HasOneGetAssociationMixin<Role>;
      }

      User.hasOne(Role);

      Returns

      The associated model, or null if no model is associated. HasOne associations are always nullable because the foreign key is on the target model.

      See

      Model.hasOne

      Parameters

      Returns Promise<T | null>

Generated using TypeDoc