sequelize / sequelize-typescript

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

Op.in operator doesn't work with array of dates. #988

Open Sven65 opened 3 years ago

Sven65 commented 3 years ago

Issue

Op.in operator doesn't work with array of dates.

Versions

Issue type

Actual behavior

I have a table class with two primary keys, one being a date, the other a string. On the class I have an async function to fetch the latest data for the IDs by using the timestamp, which works using the Sequelize.Op.in operator.

Instead of getting the data, it errors in vscode,

Type '{ [Op.in]: Date[]; }' is not assignable to type 'string | number | bigint | boolean | Date | Literal | Fn | Where | Buffer | WhereOperators | WhereAttributeHash<any> | ... 6 more ... | undefined'.
  Types of property '[Op.in]' are incompatible.
    Type 'Date[]' is not assignable to type 'string | number | bigint | boolean | Date | Literal | Fn | Where | Buffer | WhereOperators | WhereAttributeHash<any> | ... 7 more ... | undefined'.
      Type 'Date[]' is not assignable to type 'WhereAttributeHash<any>'.
        Index signature is missing in type 'Date[]'.ts(2322)

Expected behavior

I expect the [Op.in] operator to work with an array of dates.

Steps to reproduce

Related code

Related code can be found at https://gist.github.com/Sven65/fc4985b2c26a095d6255c1e9f2d3029d

daxingplay commented 3 years ago

I found it didn't work with bigint as well.