Versions
sequelize: ^6.1.1
sequelize-typescript: 2.0.0-beta.0
typescript: ^3.9.3
I'm submitting a ...
[x] bug report
[ ] feature request
Actual behavior:
Type 'typeof ProductsProperties' is not assignable to type 'typeof Model'.
Construct signature return types 'ProductsProperties' and 'Model<TModelAttributes, TCreationAttributes>' are incompatible.
The types of '_attributes' are incompatible between these types.
Type 'ProductsProperties' is not assignable to type 'TModelAttributes'.
Model class:
import { Model } from 'sequelize-typescript'
export interface ProductsPropertiesAttributes {
id?: number
value: string
createdAt: Date
}
export class ProductsProperties extends Model<ProductsProperties, ProductsPropertiesAttributes> {
...
}
Error getting in below code where the model is having red line:
this.productsModel.findByPk(keycode, {
attributes: ['keycode', 'name'],
include: [{
model: ProductsProperties
}]
})
I have this same issue. Could resolve this by removing the type constructor (<Questions>, <Options>).
In my case I had a QuestionsAttributes interface and had to change:
class TalentData extends Model<TalentData, TalentDataAttributes>
to:
class TalentData extends Model implements TalentDataAttributes
But this really appears to be a sequelize-typescript error.
Last commit on master: https://github.com/RobinBuschmann/sequelize-typescript/commit/135b88eaac1f3ec35ea509a5664fa3818ce0f1c3 is entitled rollback to 6.1.1 because of build error in 6.2.0.
In your package.json file, replace for sequelize ^6.1.1 to 6.1.1.
Most helpful comment
I have this same issue. Could resolve this by removing the type constructor (
<Questions>,<Options>).In my case I had a QuestionsAttributes interface and had to change:
to:
But this really appears to be a sequelize-typescript error.