#sequelize.js #sequelize-typescript
#sequelize.js #sequelize-typescript
Вопрос:
У меня есть сущность
@Table({tableName: 'EducationEntity'})
export class EducationEntity extends Model<EducationEntity> {
}
Я пытаюсь сделать: EducationEntity.build(plainObject as any);
построить модель из простого объекта.
Я получаю сообщение об ошибке:
src/research/research.service.ts:165:51 - error TS2684: The 'this' context of type 'typeof EducationEntity' is not assignable to method's 'this' of type '(new () => EducationEntity) amp; typeof Model'.
Type 'typeof EducationEntity' is not assignable to type 'typeof Model'.
The types returned by 'init(...)' are incompatible between these types.
Type 'void' is not assignable to type 'Model<any, any>'.
Что это, EducationEntity — это модель?
Такнс
Комментарии:
1. Вы пытаетесь, чтобы класс расширил модель с помощью типа того же класса. Вам нужно определить другой интерфейс.
2. @doublesharp не могли бы вы объяснить на небольшом примере? Спасибо