TanStackT
TanStack2y ago
22 replies
technological-jade

queryClient in context, type not inferred

Using router and query together in the file-based setup. For some reason the declaration isn't picking up on the queryClient being in context. Anybody have any clues as to why?

main.tsx
const router = createRouter({
  routeTree,
  context: {
    queryClient,
  },
  defaultPreloadStaleTime: 0,
});

// Register the router instance for type safety
declare module "@tanstack/react-router" {
  interface Register {
    router: typeof router;
  }
}


admin/index.tsx
(see photo)
Screenshot_2024-03-06_at_12.24.00_PM.png
Was this page helpful?