virtual icon indicating copy to clipboard operation
virtual copied to clipboard

TypeScript types for scrollToIndex behavior missing 'instant' option

Open gulnuravci opened this issue 2 months ago • 0 comments

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

  1. Import useVirtualizer from @tanstack/react-virtual
  2. Try to use scrollToIndex with behavior: "instant"
  3. TypeScript shows an error
  4. 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.

gulnuravci avatar Oct 31 '25 17:10 gulnuravci