Skip to content
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

Incorrect type definition in useWindowScroll #296

Open
pom421 opened this issue Apr 17, 2024 · 1 comment
Open

Incorrect type definition in useWindowScroll #296

pom421 opened this issue Apr 17, 2024 · 1 comment

Comments

@pom421
Copy link

pom421 commented Apr 17, 2024

Hi,

When I use useWindowScroll,

  useEffect(() => {
    scrollTo(0, 0);
  }, [scrollTo]);

The compiler says "Expected 1 arguments, but got 2.".

Effectively, the index.d.ts is incorrect :


  export function useWindowScroll(): [
    {
      x: number | null;
      y: number | null;
    },
    (args: unknown) => void
  ];
@pom421
Copy link
Author

pom421 commented Apr 17, 2024

For readers in a hurry, I have used this quickfix in my code 👍🏼

declare module "@uidotdev/usehooks" {
  function useWindowScroll(): [
    {
      x: number | null;
      y: number | null;
    },
    (row: number, col: number) => void,
  ];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant