T
TanStack2y ago
xenogeneic-maroon

Question about type-inference

I have file base routing set up and have the following routes (pic 1) but am getting type errors when trying to add a <Link> to '/upload/someThing' (pic 2) Am I missing something simple here?
No description
No description
11 Replies
continuing-cyan
continuing-cyan2y ago
please provide a minimal reproducer on e.g. codesandbox
xenogeneic-maroon
xenogeneic-maroonOP2y ago
I’ll try my best Just confirming though everything here makes sense on my end right?
continuing-cyan
continuing-cyan2y ago
why is the type /upload/${string}? you should pass the string literal /upload/$id as to
xenogeneic-maroon
xenogeneic-maroonOP2y ago
How do I give a value for that $id then? Think this is user error. I have
<Link to={`/upload/${props.name}`}>
<Link to={`/upload/${props.name}`}>
<Link
to={`/upload/$name`}
params={{
name: props.name,
}}
>
<Link
to={`/upload/$name`}
params={{
name: props.name,
}}
>
My bad.
continuing-cyan
continuing-cyan2y ago
yeah exactly, params is what you need
xenogeneic-maroon
xenogeneic-maroonOP2y ago
Also unrelated, but can you check something for me on the docs page? If I go to the overview page https://tanstack.com/router/v1/docs/framework/react/overview and go into the search bar, and click on ANYTHING, it just redirects me to the overview page.
Overview | TanStack Router Docs
TanStack Router is a router for building React applications. Some of its features include: 100% inferred TypeScript support
xenogeneic-maroon
xenogeneic-maroonOP2y ago
I'm assuming that is a bug?
continuing-cyan
continuing-cyan2y ago
yes, that's a bug. thanks for reporting!
xenogeneic-maroon
xenogeneic-maroonOP2y ago
Here's a recording if you need it for the bug report
continuing-cyan
continuing-cyan2y ago
perfect
xenogeneic-maroon
xenogeneic-maroonOP2y ago
Thanks again!

Did you find this page helpful?