TanStack / router

πŸ€– Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
7.27k stars 495 forks source link

Type error of the prop β€œto” Link component #1605

Closed sawa-ko closed 2 weeks ago

sawa-ko commented 2 weeks ago

Describe the bug

I am currently trying to use the Link component to visit the home page and I have 2 problems, which are typescript typing problems:

  1. if I set only the path as β€œ/” I get the following typescript error:

image

  1. if I put the prop to value as typescript says it should go now I get the following type error:

image

I don't understand how I should put the path in the to prop for the Link component, as I always get a type error anyway.

Your Example Website or App

I cannot reproduce it in the example test environment.

Steps to Reproduce the Bug or Issue

  1. Create a project using vite
  2. Install tanstack router
  3. Put the required files inside src
  4. Try to use Link componente with the prop "to"

Expected behavior

Correct typing for this component prop.

Screenshots or Videos

No response

Platform

Additional context

No response

schiller-manuel commented 2 weeks ago

it looks like you don't have any real route, just the __root.tsx. add an index.tsx route next to it and you should be able to create a <Link to="/">

SeanCassiere commented 2 weeks ago

If you want this looked into further, please open a new issue with a valid reproduction of the bug you are facing.