Skip to content

typescript error from 2.0.0-beta.0 and sequelize 6.1.1 #813

Closed
@rahulrkr08

Description

@rahulrkr08

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
      }]
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions