A
Andred Garcia Martin
Hola amigos tengo un error en el where y no se como solucionarlo, tengo el siguiente codigo.
ye me da el siguiente error en el where:
Ya he probado muchas cosas incluso Op.and y no logro solucionar
Code:
const potentialValidate: any = await RulesProductModel.findAll({
attributes: ['AllowPermanence'],
where: {
rpoMin: { [Op.gte]: 56 },
rpoMax: { [Op.lte]: 58 },
[Op.or]: [
{ districtId: { [Op.eq]: 366 } },
{ districtId: { [Op.is]: null } },
],
},
});
ye me da el siguiente error en el where:
Code:
Type '{ rpoMin: { [OpTypes.gte]: number; }; rpoMax: { [OpTypes.lte]: number; }; [OpTypes.or]: ({ districtId: { [OpTypes.eq]: number; }; } | { districtId: { [OpTypes.is]: null; }; })[]; }' is not assignable to type 'WhereOptions<RulesProduct> | undefined'.
Types of property '[Op.or]' are incompatible.
Type '({ districtId: { [OpTypes.eq]: number; }; } | { districtId: { [OpTypes.is]: null; }; })[]' is not assignable to type 'AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<Fn | Literal | Where | Json | WhereAttributeHash<RulesProduct>>> | undefined'.
Type '{ districtId: { [OpTypes.is]: null; }; }' is not assignable to type 'Fn | Literal | Where | Json | WhereAttributeHash<RulesProduct> | { [OpTypes.or]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<Fn | Literal | Where | Json | WhereAttributeHash<...>>>; } | { ...; } | { ...; }'.
Types of property 'districtId' are incompatible.
Type '{ [OpTypes.is]: null; }' is not assignable to type 'WhereAttributeHashValue<number | undefined>'.
Types of property '[Op.is]' are incompatible.
Type 'null' is not assignable to type 'Literal | undefined'.
Ya he probado muchas cosas incluso Op.and y no logro solucionar