In my NestJS project I have an abstract repository that defines the find
method as follows
find(where: FindOptionsWhere<T>) {
if (Object.keys(where).length === 0)
throw new HttpException('Can not query entity without parameters', HttpStatus.BAD_REQUEST);
try {
return this.abstractRepository.findBy(where);
} catch (error) {
this.logger.warn('Record not found with where', where);
throw new HttpException(error.message, HttpStatus.BAD_REQUEST);
}
}
Then, one of my entities, has a property defined as an enum
array like so
@Column({ type: "enum", enum: POSITION, array: true })
@IsEnum(POSITION)
positions: POSITION[];
When I try to call the find
method from my service
I’m getting this error
Argument of type 'PartialJugadorDTO' is not assignable to parameter of type 'FindOptionsWhere<JugadorEntity>'. Types of property 'positions' are incompatible. Type 'POSITION[]' is not assignable to type 'POSITION | FindOperator<POSITION>'.ts(2345)
I’m using the last version of TypeORM which is 0.3.20