Loader Errors #545
Unanswered
livevsonline
asked this question in
Q&A
Replies: 2 comments 18 replies
-
I'm also experiencing this issue. I'm not sure the |
Beta Was this translation helpful? Give feedback.
6 replies
-
It looks like the api has changed (check here 3581aec), and the doc reflects these changes despite there is no tagged version yet. |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi i am trying to implement a loader into the tanstack router, however i get some Typescript errors while tryint to do so.
This is my Routes.tsx
The two errors are placed at:
#1: async loader()
argument of type '{ id: "purchaseRunningShipped"; getParentRoute: () => RootRoute<{}, RouteContext, RouterContext>; path: "/app/purchase/running/shipped"; loader(): Promise<...>; component: () => Element; }' is not assignable to parameter of type 'RouteOptions<RootRoute<{}, RouteContext, RouterContext>, "purchaseRunningShipped", "/app/purchase/running/shipped", {}, {}, {}, {}, Record<...>, ... 4 more ..., RouterContext & RouteContext>'. Object literal may only specify known properties, and 'loader' does not exist in type 'RouteOptions<RootRoute<{}, RouteContext, RouterContext>, "purchaseRunningShipped", "/app/purchase/running/shipped", {}, {}, {}, {}, Record<...>, ... 4 more ..., RouterContext & RouteContext>'.
#2: const posts = useLoader({loader: runningAndShippedLoader})
TS2345: Argument of type '{ loader: Loader<"purchaseRunningShipped", unknown, SalesRunningPage, Error>; }' is not assignable to parameter of type '{ key: unknown; track?: ((loaderStore: LoaderStore<any, any>) => any) | undefined; } & { variables?: any; }'. Object literal may only specify known properties, and 'loader' does not exist in type '{ key: unknown; track?: ((loaderStore: LoaderStore<any, any>) => any) | undefined; } & { variables?: any; }'.
Im unsure of what im doing wrong here, i feel like the code correlate with the code in the documentation: https://tanstack.com/router/v1/docs/guide/data-loading
Does someone know what im doing wrong here? :)
Beta Was this translation helpful? Give feedback.
All reactions