I have this array.map function:
{props.help.map((e, i) => {
return <a key={i}>{e.name}</a>
})}
{e} object have ‘name’ and ‘href’ keys
i got "Property ‘name’ does not exist on type ‘object’" (typescript)
I am beginner in typescript.
>Solution :
Create an interface for a Help object, and use it in the definition of your props:
interface Help {
name: string;
// other properties
}
interface Props {
help: Help[];
}
And then use Props when defining the component:
const Component = (props: Props) => {