Navigating to add "global" search params and TS types #3156
-
I'm trying to implement a flow where clicking on something adds a search param to the URL which I then want to pick up in my root view and do something with. The code itself is working as expected, but I'm getting TS errors and can't figure out why. Here is a StackBlitz showing the errors: https://stackblitz.com/edit/tanstack-router-8ryb92gq?file=src%2Froutes%2F__root.tsx,src%2Froutes%2Findex.tsx&preset=node in __root.tsx i've defined the expected Additionally, if you comment lines 18-20 out and uncomment 12-17, there is a different error: I'm having a really hard time understanding why these errors are appearing and can't find an answer anywhere. I've followed the search params setup as closely as I could to the examples provided and the fact that it works tells me I'm doing it correctly, but no idea why the TS errors are showing up. Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
this works if you specify a const navigate = useNavigate({ from: '/' }); |
Beta Was this translation helpful? Give feedback.
"strictNullChecks": true,
is necessary for tanstack router to function properly w.r.t. typescript