Skip to content

Using offset along with limit in include options gives compilation error. But query works if I add ts-ignore to it #875

Open
@zebkailash

Description

@zebkailash

Versions

  • sequelize: 5.21.12
  • sequelize-typescript: 1.1.0
  • typescript: 3.9.5

I'm submitting a ...

[ ] bug report
[ ] feature request

Actual behavior:

It gives compilation error with message property does not exist on typeof Model | IncludedOptions etc

Expected behavior:

It should not give compilation error as query which is created works as expected.

Steps to reproduce:

  1. Create 2 Models eg: Team, Player

  2. Association Team hasMany Players.

  3. Fetch Team and its players.

Related code:

// Two models eg:
Team, Player

Team.hasMany(Players);

// Fetch team and its players let's say I want to apply pagination on players array.

// Query will be
Team.findOne({
  where: { id: 1 },
  include: [
  { model: Player, limit: 5, offset: 0 } // using offset here gives compile error 
  ]
})

Workaround
Add @ts-ignore-next-line before the offset property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions