I am currently attempting to determine whether my array of objects contains an attribute with a specific value. I wanted to use the array.some()
method instead of a foreach loop, but I keep encountering an error:
Error TS2345: Argument of type '(element: ListaDetalhePendenciaAprovacao) => void' is not assignable to parameter of type '(value: ListaDetalhePendenciaAprovacao, index: number, array: ListaDetalhePendenciaAprovacao[]) => boolean'. Type 'void' is not assignable to type 'boolean'.
The code snippet causing the issue is as follows:
let existeApr = this.pendenciasList.some(element =>{
!isUndefined(element.isSelected) && element.isSelected
})
let existeRej = this.pendenciasList.some(element =>{
!isUndefined(element.isSelected) && element.isSelected
})
I am facing a similar problem with array.findIndex(). I apologize for the attributes being in my native language, I hope it does not cause any confusion. Thank you in advance!