-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type errors in generated src/router.tsx
(with TanStack Start & Query)
#51
Comments
src/router.tsx
(with TanStack Query)src/router.tsx
(with TanStack Start & Query)
We are waiting on some infra questions to be resolved before the Start + Sentry configuration works well. |
jherr
pushed a commit
that referenced
this issue
Mar 10, 2025
It would be great if |
I'll pass that on! |
I found the solution: const queryClient = new QueryClient({
defaultOptions: {
dehydrate: { serializeData: superjson.serialize },
hydrate: { deserializeData: superjson.deserialize },
},
});
const trpcClient = createTRPCClient<TRPCRouter>({
links: [
httpBatchStreamLink({
transformer: superjson,
url: getUrl(),
}),
],
});
const serverHelpers = createTRPCOptionsProxy({
client: trpcClient,
queryClient,
});
const router = createTanStackRouter({
context: { queryClient, trpc: serverHelpers }, You can look at the example of trpc https://github.com/trpc/trpc/tree/045fe47ec3c0fa39141e9048c38902fae41fc5ba/examples/tanstack-start/app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which project does this relate to?
Create Tanstack App
Describe the bug
The generated
src/router.tsx
contains two type errors:The first one says:
It looks like
createTanstackRouter
cannot properly infer types from the generatedrouteTree
, not even after starting the app in dev or production mode, and I'm not sure why this happens.The second one comes from here:
create-tsrouter-app/templates/react/add-on/start/assets/src/router.tsx.ejs
Line 64 in a3e575f
...where we should have
router: ReturnType<typeof createRouter>
, if the "tanstack-query" add-on is enabled.I can come up with a PR to fix it, but there's also this and I don't think they should be addressed in isolation.
I'm yet unfamiliar with the codebase, but it looks to me that if somebody selects both "sentry" and "tanstack-query", we end up with two router instances, aren't we?...
Your Example Website or App
none provided
Steps to Reproduce the Bug or Issue
pnpm create tsrouter-app@latest --add-ons
, make sure to select TanStack Start & Querysrc/router.tsx
in VSCodeExpected behavior
No type errors.
Screenshots or Videos
No response
Platform
Irrelevant.
Additional context
No response
The text was updated successfully, but these errors were encountered: