https://github.com/sequelize/sequelize/issues/11081#issuecomment-515114663
This does not work:
Purchase.scope(scope).findOrCreate({
where: {
referenceId: 5,
},
order: [["updatedAt", "DESC"]],
});
The typescript error:
Argument of type '{ where: { referenceId: number; }; order: string[][]; }' is not assignable to parameter of type 'FindOrCreateOptions'.
Object literal may only specify known properties, and 'order' does not exist in type 'FindOrCreateOptions'.ts(2345)
sequelize-typescript: 1.0.0-beta.3
Dialect:
Is this a sequelize or sequelize-typescript issue ?
https://github.com/sequelize/sequelize/issues/11081#issuecomment-515114663
This is a sequelize issue. Since 1.0.0 sequelize-typescript uses the official typings of sequelize. According to their typings, order: [["updatedAt", "DESC"]], is not allowed here. As you can see here: https://github.com/sequelize/sequelize/blob/master/types/lib/model.d.ts#L667 FindOrCreateOptions has no order property, since FindOrCreateOptions doesn't extend IncludeOptions
Closing this, since it is a sequelize issue - not a sequelize-typescript one
Most helpful comment
This is a sequelize issue. Since 1.0.0 sequelize-typescript uses the official typings of sequelize. According to their typings,
order: [["updatedAt", "DESC"]],is not allowed here. As you can see here: https://github.com/sequelize/sequelize/blob/master/types/lib/model.d.ts#L667FindOrCreateOptionshas noorderproperty, sinceFindOrCreateOptionsdoesn't extendIncludeOptions