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 with sequelize literal #11080

Closed
5 tasks
fareshan opened this issue Jun 18, 2019 · 4 comments
Closed
5 tasks

typescript error with sequelize literal #11080

fareshan opened this issue Jun 18, 2019 · 4 comments

Comments

@fareshan
Copy link

This does not work:

const aas = await A.findAll({
      where: Sequelize.literal(
        `id IN (
            SELECT "aaId"
            FROM "Pp"
            WHERE "ppId" = 10
            )
        `,
      ),
    });

The typescript error:

Argument of type '{ where: Literal; }' is not assignable to parameter of type 'FindOptions'.
  Types of property 'where' are incompatible.
    Type 'Literal' is not assignable to type 'WhereAttributeHash | AndOperator | OrOperator | Where | undefined'.
      Type 'Literal' is not assignable to type 'WhereAttributeHash'.
        Index signature is missing in type 'Literal'.ts(2345)

Environment

sequelize-typescript: 1.0.0-beta.3
Dialect:

  • mysql
  • [ X ] postgres
  • sqlite
  • mssql
  • any
    Dialect library version: pg version 6.4.2
    Database version: 9.6.12
    Sequelize version: 5.8.10
    Node Version: 8.11.4
    OS: macOS 10.14.3
    TypeScript version: 3.4.3 (or 3.3.3 same issue)
    Tested with latest release:
  • No
  • [ X ] Yes, specify that version: 5.8.10
@leejh3224
Copy link

refer to this issue

@fareshan
Copy link
Author

@leejh3224 this looks more like a turnaround than a solution

@fareshan
Copy link
Author

this issue is fixed with this fix:
https://github.com/sequelize/sequelize/pull/10990

@papb
Copy link
Member

papb commented Jul 11, 2019

Fixed by #10990

(the link by @fareshan above was broken)

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

No branches or pull requests

3 participants