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

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

Open Sven65 opened this issue 4 years ago • 1 comments

Issue

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

Versions

  • sequelize: 6.6.2
  • sequelize-typescript: 2.1.0
  • typescript: 4.2.3

Issue type

  • [x] bug report
  • [ ] feature request

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

Sven65 avatar Apr 16 '21 08:04 Sven65

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

daxingplay avatar Jul 07 '21 07:07 daxingplay