`createRouter` types: not passing convex property through
I'm having trouble with types when I copy the https://github.com/TanStack/router/tree/main/examples/react/start-convex-trellaux/convex example outside the monorepo.
In the monorepo
createRouter
properly forwards the context, but when I copy the example out of the monorepo the context is gone.
I'll look into it, just checking if anyone's aware of the context property not being properly forwarded in some situations.GitHub
router/examples/react/start-convex-trellaux/convex at main · TanSta...
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router


13 Replies
adverse-sapphire•11mo ago
is this a new issue?
harsh-harlequinOP•11mo ago
I don't know, it's possible this has never worked.
adverse-sapphire•11mo ago
i mean, did it work before?
harsh-harlequinOP•11mo ago
also "copying it out of the monorepo" is underspec'd, I'll drill down to figure out what dependency differences there are. The top-level deps have the same versions installed but transitively I bet things are different.
adverse-sapphire•11mo ago
just copied it out of the monorepo, reinstalled and this is what I get in
app/client.tsx

harsh-harlequinOP•11mo ago
ah thanks for checking, v helpful to know you can't repro
oh wait this is a bit different
oh intersting, does createRouter() just always have queryClient in there? nm this makes sense
adverse-sapphire•11mo ago
comes from
routerWithQueryClient
and the root route
if you have a repro repo that does not behave as it should, send it overharsh-harlequinOP•11mo ago
I see QueryClient has some nominal typing, maybe I have duplicate copies of that library or its types
great I'll make a minimal repro
harsh-harlequinOP•11mo ago
nope both coming from the same types file

harsh-harlequinOP•11mo ago
ok a simple copy out works for me too, it's only when I try to recreate from this guide https://tanstack.com/router/latest/docs/framework/react/start/getting-started that I see the bad type, will look for differences here
Oops! It's the same thing that's happened to me before, in app/routes/__root.tsx using
createRootRouter
instead of createRootRouterWithContext
Resolved, thanks for trying it real quick @Manuel Schilleradverse-sapphire•11mo ago
if you have an idea how to make this obvious by an eslint rule or similar , let me know
harsh-harlequinOP•11mo ago
thanks, will let you know. I'm adding it to a quickstart so eventually something like this in a CLI creation tool could make sense
harsh-harlequinOP•11mo ago
hm it's not just me https://github.com/TanStack/router/discussions/2668
GitHub
Help with loader context type safety. · TanStack router · Discussio...
Hi there, I'm trying to follow the Kitchen Sink with React Query File Based example and I'm unsure if I'm doing something wrong. I start by setting up the query client and the router, i...