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
useVirtualizer from @tanstack/react-virtual
- Try to use
scrollToIndex with behavior: "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
Describe the bug
Hello!
The
scrollToIndexmethod'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
useVirtualizerfrom@tanstack/react-virtualscrollToIndexwithbehavior: "instant""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
ScrollBehaviortype should be:Instead of the current:
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