Loosing type safety when wrapping <Link>
Anyone have an idea on how to keep type safety while wrapping <Link> in a generic component like so? Right now typescript allows me to provide invalid routes like so
<Link to="/invalid"> and I don't like that I loose the type safety.
4 Replies
conscious-sapphire•11mo ago
Custom Link | TanStack Router React Docs
While repeating yourself can be acceptable in many situations, you might find that you do it too often. At times, you may want to create cross-cutting components with additional behavior or styles. Yo...
eager-peach•5mo ago
@thehornta what did the end result look like, the linked docs only talk about custom link components, not having type safe props for the official
<Link/> component.extended-salmon•5mo ago
Type Utilities | TanStack Router React Docs
Most types exposed by TanStack Router are internal, subject to breaking changes and not always easy to use. That is why TanStack Router has a subset of exposed types focused on ease of use with the in...
eager-peach•5mo ago
Perfect, thank you