I am new to ts and i am struggling with making things work. This time, I have data as an array and i want to find last element in array that match a condition
const data = props.data as Array<MessageEvent<unknown>>;
const objectData = data.findLast((element as MessageEvent<unknown>) => {
return element.topic == CAMERA_TRACK_TOPIC;
}) as MessageEvent<Epm5Msg>;
i am getting error in findLast stating that
Property ‘findLast‘ does not exist on type type1 ( i removed the type schema but it was type schema of MessageEvent<unknown>
.
can anyone help me on this.