I’m having a map method and expecting it to return a new array. And I’m having an error “Property ‘id’ does not exist on type ‘never'” . I think it’s because I didn’t type the map method variables. How can I do it ?
type Props = {
authors: [];
onFinish: () => {};
};
const NewTask: FC<Props> = ({ authors, onFinish }) => {
return (
<select
onChange={(e) => setAuthor(e.target.value)}
defaultValue="select"
>
<option value="select" disabled>
Select Author
</option>
{authors.map((author) => (
<option key={author.id} value={author.author_name}> // author keys are error sublimed
{author.author_name}
</option>
))}
</select>
)
}