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.19k stars 486 forks source link

feat: `trailingSlashes` option on the type level #1509

Closed chorobin closed 3 weeks ago

chorobin commented 3 weeks ago

We can infer trailingSlashes from the router and use it to enforce the to prop when navigating.

trailingSlashes currently has three options: always | never | preserve.

always - we always have a trailing slash on leaves autocompleted with to. Branches are not affected in from as you might want a loose match on this for any leaves under a branch instead of an index route.

never - we never have a trailing slash on leaves when autocompleted on to. from does not change as mentioned in always

preserve - to autocompletes to include both trailing slash or without in the union. It can be either.

nx-cloud[bot] commented 3 weeks ago

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 3cead7f7bbeea35150dc2fdfc4ea37fb14b3e001. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets - [`nx affected --targets=test:format,test:eslint,test:unit,test:build,build --parallel=3`](https://cloud.nx.app/runs/GCzkOKX8F7?utm_source=pull-request&utm_medium=comment) - [`nx affected --target=test:types --exclude=examples/**`](https://cloud.nx.app/runs/lblHM7PVWN?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.

chorobin commented 3 weeks ago

Don't merge yet. I want to add more type tests to cover over parts that could have regressed

chorobin commented 3 weeks ago

Should be ok to merge when approved