sequelize / sequelize-typescript

Decorators and some other features for sequelize
MIT License
2.78k stars 280 forks source link

TypeError when using Includable and $get #925

Open Bialogs opened 3 years ago

Bialogs commented 3 years ago

Issue

Versions

Issue type

Actual behavior

TypeError: options.include.push is not a function

Expected behavior

Query executes with include options.

Steps to reproduce

Essentially the error shows up when using $get with include options and only passing a singular Model instead of an array of Models.

user.$get('groups', {include: User}); Doesn't work user.$get('groups', {include: [User]}); Works

Basically with the $get function you can't use Includable but must use Includable[] type

Related code

Not to get you too involved with our current work in progress but you can see the change required here and all the additional context of the application:

usmansbk commented 3 years ago

Thanks. I had a hard time trying to figure out what I was doing wrong