virtual
virtual copied to clipboard
TypeScript types for scrollToIndex behavior missing 'instant' option
Describe the bug
Hello!
The scrollToIndex method's behavior option has incomplete TypeScript types. According to the MDN docs, the native browser API supports three behavior values:
-
"auto" -
"smooth" -
"instant"
However, TanStack Virtual's types only include "auto" | "smooth", but missing "instant".
Thank you for your time!
Your minimal, reproducible example
See description above - this is a TypeScript type definition bug, not a runtime issue.
Steps to reproduce
- Import
useVirtualizerfrom@tanstack/react-virtual - Try to use
scrollToIndexwithbehavior: "instant" - TypeScript shows an error
- The type only allows
"auto" | "smooth"but the native browser API supports"instant"
Expected behavior
TypeScript should accept behavior: "instant" without errors, since it's a valid value according to the W3C spec and works correctly at runtime.
The ScrollBehavior type should be:
type ScrollBehavior = 'auto' | 'smooth' | 'instant';
Instead of the current:
type ScrollBehavior = 'auto' | 'smooth';
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
N/A - This is a TypeScript type definition issue that affects all platforms
tanstack-virtual version
3.13.5
TypeScript version
5.9.2
Additional context
No response
Terms & Code of Conduct
- [x] I agree to follow this project's Code of Conduct
- [x] I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.