TanStackT
TanStack15mo ago
11 replies
colossal-harlequin

Typesafety on use useLocation

Hey all!

Not sure if Im doing something wrong or if I just don't understand what should be happening here:

Im trying to get typesafety on useLocation(), example:

  const location = useLocation();
  location.pathname === "" // <<<< Should I be having my paths autocomplete here??


I assumed, yes, I should be getting autocomplete here. But the type is just ParsedLocation<{}>.pathname: string

Not sure if it helps, but I am using a hash router (I know I know, unfourtunately can't do anything about it)

Thanks!
Was this page helpful?