type List<T> = {
items: T[];
clickHandler: (a: T) => void;
};
const List = <T extends {}>({
items,
clickHandler,
}: List<T>) => {
return (
<div>
{items.map((item, index) => (
<div key={index} onClick={() => clickHandler(item)}>
{item} // error is showing here
</div>
))}
</div>
);
};
export default List;
typescript Error Type 'T' is not assignable to type 'ReactNode'. Type '{}' is not assignable to type 'ReactNode'. Type 'T' is not assignable to type 'ReactPortal'. Type '{}' is missing the following properties from type 'ReactPortal': key, children, type, propsts(2322)