Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rahulrkr08 opened this issue Jul 16, 2020 · 2 comments · Fixed by #900
Closed

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

rahulrkr08 opened this issue Jul 16, 2020 · 2 comments · Fixed by #900

Comments

@rahulrkr08
Copy link

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
      }]
    })
@maracaipe
Copy link

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.

@jgburet
Copy link

jgburet commented Sep 13, 2020

Last commit on master: 135b88e 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants