Type alias HasOneGetAssociationMixin<T>

HasOneGetAssociationMixin<T>: ((options?) => 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);

Type Parameters

Type declaration

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