sequelize / sequelize-typescript

Decorators and some other features for sequelize
MIT License
2.79k stars 282 forks source link

Op.not operator shows a warning #1095

Open deepaknyk opened 3 years ago

deepaknyk commented 3 years ago

Issue

Using Op.not operator in any of the queries, Eg: findAll, findOne.. shows a warning in my code editor (VS Code). But the code compiles and runs without any error.

where: {
  [Op.not]: true
}

Error:

Type '{ [Op.not]: true; }' is not assignable to type 'WhereOptions<any>'.
  Types of property '[Op.not]' are incompatible.
    Type 'true' is not assignable to type 'undefined'.ts(2322)
model.d.ts(850, 3): The expected type comes from property 'where' which is declared here on type 'UpdateOptions<any>'

Versions

Issue type

Actual behavior

Expected behavior

Steps to reproduce

Related code

lukashroch commented 3 years ago

It's most likely issue of sequelize types rather than sequelize-typescript as it doesn't modify these types, just extends couple of model related ones. Would recommend opening issue in sequelize repo if not already opened.

deepaknyk commented 3 years ago

It's most likely issue of sequelize types rather than sequelize-typescript as it doesn't modify these types, just extends couple of model related ones. Would recommend opening issue in sequelize repo if not already opened.

Okay, thank you

ephys commented 2 years ago

We have recently fixed this in Sequelize 7, but it hasn't been backported to Sequelize 6 yet https://github.com/sequelize/sequelize/pull/14022