T
TanStack4w ago
wise-white

How to get Route Type from Tanstack Start route tree gen

I am building a sidebar, thats configured by a const. I have the following type
import { FileRoutesByFullPath } from '@/routeTree.gen';
import { type LucideIcon } from 'lucide-react';

export type SidebarData = {
navMain: {
title: string;
url: keyof FileRoutesByFullPath;
icon?: LucideIcon;
isActive?: boolean;
items?: {
title: string;
url: keyof FileRoutesByFullPath;
}[];
}[];
};
import { FileRoutesByFullPath } from '@/routeTree.gen';
import { type LucideIcon } from 'lucide-react';

export type SidebarData = {
navMain: {
title: string;
url: keyof FileRoutesByFullPath;
icon?: LucideIcon;
isActive?: boolean;
items?: {
title: string;
url: keyof FileRoutesByFullPath;
}[];
}[];
};
I get a type error when passing in the URL to a <Link> component from react-router. Is this the correct way to do this?
1 Reply
wise-white
wise-whiteOP3w ago
i used the following to make this work
import { FileRoutesByTo } from '@/routeTree.gen';
import { FileRoutesByTo } from '@/routeTree.gen';

Did you find this page helpful?