I have a loader with defer:
import { defer } from 'react-router-typesafe';
...
export const dashboardLoader = (queryClient: QueryClient) => () => {
return defer<{
dashboardInfo: Promise<DashboardType>;
}>({
dashboardInfo: queryClient.ensureQueryData(dashboardInfoQueries.info()),
});
};
and I have a RouteObject like this in typesafeBrowserRouter:
{
index: true,
loader: dashboardLoader(queryClient),
async lazy() {
const { Dashboard } = await import('@/views/dashboard/Dashboard');
return { element: <Dashboard /> };
},
},
I get an error: Type () => DeferredData<{ dashboardInfo: Promise<DashboardType>; }> is not assignable to type NarrowKeys<boolean | LoaderFunction<any> | undefined>
This doesn't happen when I am using a regular loader without defer.
Oh, and when I just switch from typesafeBrowserRouter to createBrowserRouter everything works just fine since then, loader doesn't have that NarrowKeys type.
I have a loader with defer:
and I have a RouteObject like this in
typesafeBrowserRouter:I get an error:
Type () => DeferredData<{ dashboardInfo: Promise<DashboardType>; }> is not assignable to type NarrowKeys<boolean | LoaderFunction<any> | undefined>This doesn't happen when I am using a regular loader without defer.
Oh, and when I just switch from
typesafeBrowserRoutertocreateBrowserRoutereverything works just fine since then, loader doesn't have that NarrowKeys type.