Having trouble avoiding the use of 'any' as the type definition when pushing elements into an array? I attempted to specify the type but encountered an error. Here is a snippet of the code:
interface answerProps {
state: string;
answer: string;
}
const results: Array<string> = [];
!isEmpty(answers) &&
answers.map((item: any) => results.push(`${item.state} : ${item.answer}`));
In the example above, my goal was to eliminate the necessity of using 'any' while mapping through the array elements.