Skip to content
Source
Sign inSign up
TanStack/router

[Typesafe routing] Uncatched typescript error #5466

Send to my agent
Openbalzdur(GitHub profile, opens in a new tab) opened this issue 0 comments

Which project does this relate to?

Router

Describe the bug

I expect TS to catch an invalid navigation construct. When doing some dynamic routing, if I inject a union type as to param, in certain situation TS seems to ignore invalid routes.

In the example, you'll see that using absolute path raise the error, while relative one is silently ignored.

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-vh8dm4rb?file=src%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Open the repro
  2. See the TS error in action

Expected behavior

Ideally, the TS error should be consistent while using absolute/relative routing.

Screenshots or Videos

No response

Platform

  • Router / Start Version: [e.g. 1.121.0]
  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Browser Version: [e.g. 91.1]
  • Bundler: [e.g. vite]
  • Bundler Version: [e.g. 7.0.0]

Additional context

No response

Sign in to join this conversation.