sequelize-typescript icon indicating copy to clipboard operation
sequelize-typescript copied to clipboard

Op.not operator shows a warning

Open deepaknyk opened this issue 3 years ago • 3 comments

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

  • sequelize: 6.6.5
  • sequelize-typescript: 2.1.0
  • typescript: 4.2.3

Issue type

  • [x] bug report
  • [ ] feature request

Actual behavior

Expected behavior

Steps to reproduce

Related code

deepaknyk avatar Sep 20 '21 11:09 deepaknyk

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.

lukashroch avatar Oct 10 '21 10:10 lukashroch

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

deepaknyk avatar Oct 11 '21 02:10 deepaknyk

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

ephys avatar Apr 07 '22 13:04 ephys