Implicit any Typescript error on index route under layout
Gday I'm running into typescript error on an index route nested under a layout.
Here's a stackblitz that reproduces the error:
https://stackblitz.com/edit/github-q3gdef?file=src/routes/_auth.tsx,src/routes/_auth/index.tsx,src/routes/_auth/posts.index.tsx,src/main.tsx,src/routeTree.gen.ts
I've just been ignoring it so far but it does muck up the global router type.
It's the same error described here: https://github.com/TanStack/router/issues/694 Not sure if the cause is the same.
Any ideas what's happening in this sitation? Can raise a github issue if that's helpful.
Thanks for all great work on this project 😄
StackBlitz
Router Quickstart File Based Example - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
GitHub
Latest version now causes Router instance to show an error of: 'rou...
Describe the bug The last version introduced some sort of type issue. Router instance now has a TS error: 'router' implicitly has type 'any' because it does not have a type annotati...
4 Replies
like-gold•2y ago
The type error goes away if you
throw the redirect instead of return:
https://stackblitz.com/edit/github-q3gdef-zb6rvm?file=src%2Froutes%2F_auth%2Findex.tsxManuel Schiller
StackBlitz
Router Quickstart File Based Example (forked) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
like-gold•2y ago
might be a bug
broad-brownOP•2y ago
Ahh nice! This is a fine workaround for me. Let me know if you'd like me to raise a github issue. Thanks a lot 🙌
like-gold•2y ago
you are always welcome to create GH issues, otherwise stuff gets lost in discord