Skip to content

TypeScript complains about $nested.column$ syntax in query where clause. #13288

Description

@MarkMurphy

Issue Description

What was unclear/insufficient/not covered in the documentation

TypeScript complains about $nested.column$ syntax in query where clause. Because the where clause is typed as needing to be attributes of the model being queried, this syntax triggers an error since these object keys are not attributes of the model.

If possible: Provide some suggestion on how we can enhance the docs

Maybe this is a bug if it's intended to work but otherwise the documentation seems to be lacking how to resolve this.

Additional context

Screen Shot 2021-05-26 at 10 11 41 AM

Issue Template Checklist

Is this issue dialect-specific?

  • No. This issue is relevant to Sequelize as a whole.
  • Yes. This issue only applies to the following dialect(s): XXX, YYY, ZZZ
  • I don't know.

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I don't know how to start, I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.

Activity

  1. added
    docs
    on May 26, 2021
  2. belisarenata commented on May 27, 2021

    @belisarenata

    Same problem here. TS indicates No overload match, but works just fine when a ts ignore flag is set to the nested clause as a workaround:
    Screenshot from 2021-05-27 14-08-44

    Also, at Sequelize V.5 this does not raise any errors.

  3. added
    good first issue
    typescript
    and removed
    docs
    on May 27, 2021
  4. added a commit that references this issue on Sep 4, 2021
    01dd31c
  5. aryem commented on Sep 4, 2021

    @aryem
    Contributor

    @MarkMurphy Can you specify sequelize version.
    In v6.6.5 WhereOptions have Literal that should support nested column literal.

    export type WhereOptions<TAttributes = any> =

  6. aryem commented on Sep 4, 2021

    @aryem
    Contributor

    I have added additional tests to ensure nested column in where option in #13478

  7. added a commit that references this issue on Oct 2, 2021
    26b62c7
  8. github-actions commented on Oct 9, 2021

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 6.7.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  9. MarkMurphy commented on Oct 18, 2021

    @MarkMurphy
    Author

    This is still an issue. It works if TAttributes is any (type WhereOptions<TAttributes = any>) because attributes there are defined as any but it won't work otherwise.

    Screen Shot 2021-10-18 at 12 38 26 PM

  10. reopened this on Jan 21, 2022
  11. ephys commented on Jan 21, 2022

    @ephys
    Member

    I have a PR in progress for this #13983
    The test added by the previous PR was flawed as the Model did not declare any attributes - it accepted any input by default.

  12. self-assigned this
    on Jan 21, 2022
  13. added a commit that references this issue on Jun 2, 2022
    d8ca9e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issuereleasedtypescript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions