Skip to content

fix(model.d): accept [Op.is] in where (broken in TypeScript 4.4)#13499

Merged
Keimeno merged 4 commits into
sequelize:mainfrom
zorji:main
Oct 10, 2021
Merged

fix(model.d): accept [Op.is] in where (broken in TypeScript 4.4)#13499
Keimeno merged 4 commits into
sequelize:mainfrom
zorji:main

Conversation

@zorji
Copy link
Copy Markdown
Contributor

@zorji zorji commented Sep 15, 2021

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

The following code break since TypeScript 4.4.3 (it was working until 4.3.5).

MyModel.findAll({
    where: {
      [Op.and]: {
        myField: { [Op.is]: null },
      },
    },
  })

Looks like before 4.3.5 it does not complain if I put excess properties, e.g. the following code can be compiled.

MyModel.findAll({
    where: {
      [Op.and]: {
        myField: { someRandomString: null },
      },
    },
  })

@zorji zorji marked this pull request as ready for review September 15, 2021 11:36
@zorji zorji changed the title fix(model.d): accept [Op.is] in where (broken in TypeScript 4.4) fix where condition for Op.is and Op.between (broken in TypeScript 4.4) Sep 15, 2021
Comment thread types/lib/model.d.ts Outdated
@zorji zorji changed the title fix where condition for Op.is and Op.between (broken in TypeScript 4.4) fix where condition for Op.is (broken in TypeScript 4.4) Sep 15, 2021
@zorji zorji changed the title fix where condition for Op.is (broken in TypeScript 4.4) fix(model.d): accept [Op.is] in where (broken in TypeScript 4.4) Sep 15, 2021
@zorji
Copy link
Copy Markdown
Contributor Author

zorji commented Sep 15, 2021

Reverted my change to Op.between as I saw another PR has addressed the issue #13486

@Keimeno Keimeno merged commit d685a9a into sequelize:main Oct 10, 2021
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

aliatsis pushed a commit to creditiq/sequelize that referenced this pull request Jun 2, 2022
…uelize#13499)

* fix(model.d): accept `[Op.is]` in where

* fix(model.d): test `[Op.is]` in where

Co-authored-by: Sascha Depold <sdepold@users.noreply.github.com>
Co-authored-by: Constantin Metz <58604248+Keimeno@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants