I am working with a Sequelize model that looks like this:
export class Opportunity extends Model {
@IsUUID(4)
@PrimaryKey
@Column({
type: DataType.UUID,
})
opportunityId: string;
@ForeignKey(() => AccountContact)
@Column({
type: DataType.UUID,
})
accountContactId: string;
@BelongsTo(() => AccountContact)
accountContact: AccountContact;
}
When I use this model, I encounter an issue where Visual Studio Code incorrectly indicates that the method getAccountContact does not exist in type Opportunity. However, Sequelize actually creates this method dynamically and it functions correctly.
Is there a way to make Visual Studio Code recognize these on-the-fly created methods? The false errors are causing some confusion for me as certain file names are highlighted in red.
I understand that Eager Loading could be a solution, but in this particular scenario, it may not be appropriate.