Steve A
Steve A•7d ago

Type checking with tanstack router

I've been developing a project with tanstack router, deno, and hono. It's working fine; my IDE is happy, the app runs, and I can run deno lint and deno format without issues. However, when I run deno check, I always get errors like this:
TS2345 [ERROR]: Argument of type '"/visualize"' is not assignable to parameter of type 'undefined'.
export const Route = createFileRoute("/visualize")({
~~~~~~~~~~~~
at file:///Users/steve.adams/Work/DarwinKit/src/routes/visualize.tsx:28:38
TS2345 [ERROR]: Argument of type '"/visualize"' is not assignable to parameter of type 'undefined'.
export const Route = createFileRoute("/visualize")({
~~~~~~~~~~~~
at file:///Users/steve.adams/Work/DarwinKit/src/routes/visualize.tsx:28:38
I'm hoping someone might be able to clue me in to why deno's type checker wouldn't be aware of the tanstack router types. The tanstack router model is declared in the generated route tree, along with in my app's entry point:
import { routeTree } from "./routeTree.gen.ts";

const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60 * 5,
retry: 1,
},
},
});

const router = createRouter({
routeTree,
context: { queryClient },
defaultPreload: "intent",
});

declare module "@tanstack/react-router" {
interface Register {
router: typeof router;
}
}
import { routeTree } from "./routeTree.gen.ts";

const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60 * 5,
retry: 1,
},
},
});

const router = createRouter({
routeTree,
context: { queryClient },
defaultPreload: "intent",
});

declare module "@tanstack/react-router" {
interface Register {
router: typeof router;
}
}
Thanks for any insight here! I'm really stumped.
3 Replies
marvinh.
marvinh.•7d ago
Can you file an issue for that https://github.com/denoland/deno/issues ?
GitHub
denoland/deno
A modern runtime for JavaScript and TypeScript. Contribute to denoland/deno development by creating an account on GitHub.
Steve A
Steve AOP•5d ago
Yes! I'll make a repro and throw it up. This is driving me nuts 😃 Is there a specific, preferred way to make repros? I could make a new repository, but perhaps there's a playground or sandboxing system running live that maintainers prefer?
marvinh.
marvinh.•5d ago
A GitHub repository is fine as a reproduction

Did you find this page helpful?