[@loopback/sequelize] Typescript error when using the "required" property with Sequelize
Describe the bug
When trying to use the new "required: true" to use an Inner Join instead of a Left Join, it leads to a Typescript error:
Type '{ relation: string; scope: { where: { id: number; }; }; required: true; }'
is not assignable to type 'InclusionFilter'.
Object literal may only specify known properties, and 'required'
does not exist in type 'Inclusion'.
53 required: true
This also happens for nested relation operations such as:
myRepository(foreignKey).find({
include: [
{
// ...
required: true
}
]
}
Logs
No response
Additional information
Reproduction
https://codesandbox.io/p/devbox/loopback-sequelize-types-24l36w
@KalleV is this fixed with #10192 or do we need any more update for this ? Can you please elaborate if anything is pending here ?
@samarpanB It is partially fixed by https://github.com/loopbackio/loopback-next/pull/10192. It will still give an error for the required property on nested relation operations like:
myRepository(foreignKey).find({
include: [
{
// ...
required: true
}
]
}
Without global declaration merging or modifying the original Inclusion interface, I tried a couple of approaches for this, like defining a custom HasManyThroughFactory interface (e.g., https://github.com/loopbackio/loopback-next/pull/10192#discussion_r1402763654).