-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] initialTopMostItemIndex={undefined} causes runtime error #777
Comments
This has been discussed on several occasions (here: #532). I don't plan on supporting passing |
I understand that allowing |
I have not given this enough attention, but I am not sure if the typings themselves are to be changed or you need to do this on the project side: microsoft/TypeScript#44421. Happy to accept a PR if you have the time to dive into the issue. |
The List component explicitly allows to pass react-virtuoso/src/components.tsx Line 80 in 374f024
I'm not sure why it works when you omit the property altogether, but when you pass undefined to it it breaks. Practically speaking, those two should be identical. <Virtuoso data={data} />
// vs.
<Virtuoso data={data} initialTopMostItemIndex={undefined} /> |
Check the link I sent and this one. There is a difference between property: number | undefined and
I believe that the typings are correct. |
@petyosi thank you for the link. I see now how these two are different. Though, I think this will keep coming back to you - especially since this setting is not enabled by default in TS. Anyway, I appreciate you looking into this. Thank you for your time 🙏🏽 |
Describe the bug
According to the typescript typing, the property
initialTopMostItemIndex
is optional. But whenundefined
is passed into it, it causes runtime error.To Reproduce
Steps to reproduce the behavior:
initialTopMostItemIndex
from undefined to 0 and it will work.Expected behavior
The TypeScript definiton should be updated or it should be possible to pass
undefined
into this property.The text was updated successfully, but these errors were encountered: