Closed bb closed 3 years ago
@bb - Me neither, TBH. I googled several "generic React components" phrases, but nothing seems to make sense.
Thanks for the quick reply! I don't have the time to investigate deeper right now, but I'll give it another try later. Or maybe somebody else chimes in. 😉
For Future-Me or whoever implements that: I just noticed that this would ideally also apply to data
property of Item
and RecordItem
as well as ItemContent
and GroupItemContent
(defined in interfaces.ts). This would help e.g. in itemsRendered
.
I don't think (but I might be wrong) that you have to interfere with interfaces.ts. The "official" typings of the component are re-declared in components.ts
for documentation purposes. While they do extend some interfaces from interfaces.ts, this is mostly to avoid duplication.
I had a try at adding generic typing to the Virtuoso
and GroupedVirtuoso
components in the PR above.
:tada: This issue has been resolved in version 1.1.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Hi Petyo,
thanks for creating react-virtuoso. It works really great for me.
I just upgraded to 1.0 and wanted to try the new
data
parameter initemContent
and noticed it was typedany
instead of the inferable type from<Virtuoso data={...} ...
prop.I think it can be added like this:
However, I don't know to parameterize the
export const
lines at the very end of components.tsx, yet. Maybe you do? If you have a pointer how to fix that, I might be able to provide a PR.