I've been attempting to incorporate a model using sequelize-typescript:
type AppMetaDataAttributes = {
id: string;
name: string;
version: string;
createdAt: string;
updatedAt: string;
};
type AppMetaDataCreationAttributes = Optional<AppMetaDataAttributes, 'id'>;
@Table
class AppMetaData extends Model<AppMetaDataAttributes, AppMetaDataCreationAttributes> {
@Column
id: string;
@Column
name: string;
@Column
version: string;
@Column({ field: 'created_at' })
createdAt: string;
@Column({ field: 'updated_at' })
updatedAt: string;
constructor(id: string, name: string, version: string, createdAt: string, updated: string) {
super();
this.id = id;
this.name = name;
this.version = version;
this.createdAt = createdAt;
this.updatedAt = updated;
}
}
MySqlInstance.addModels([AppMetaData]);
export default AppMetaData;
However, I encountered the following error in the line
MySqlInstance.addModels([AppMetaData]);
:
No overload matches this call.
The last overload gave the following error.
Type 'typeof AppMetaData' is not assignable to type 'string | ModelCtor<Model<any, any>>'.
Type 'typeof AppMetaData' is not assignable to type 'ModelCtor<Model<any, any>>'.
Type 'typeof AppMetaData' is not assignable to type 'new () => Model<any, any>'.
Types of construct signatures are incompatible.
Type 'new (id: string, name: string, version: string, createdAt: string, updated: string) => AppMetaData' is not assignable to type 'new () => Model<any, any>'.ts(2769)
sequelize.d.ts(16, 5): The last overload is declared here.
I followed the guidelines provided in the official documentation found here, but I'm unsure where I went wrong?