Replies: 1 comment 1 reply
-
It is possible to provide the correct types directly for RRv7 (at least in framework mode; I have no experience with non-fw-mode). I just finished a vite plugin to provide those types (90% of the code is copied from the awesome safe-routes package, previously known as remix-routes). The feature requires type generation, but since RR now does that anyways, it should be really simple to hook into its functionality. My vite plugin already places the necessary file into the new Once I get around to it, I'll either try to implement it in RR directly, or at least publish the vite plugin somewhere... The result: const rootLoaderData = useRouteLoaderData("root");
// ^ this has its type inferred correctly now
useRouteLoaderData("this_route_id_doesnt_exist");
// ^ this is a type error |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now
useRouteLoaderData
returns anunknown
type. Understandably, it's probably impossible to provide the correct types directly, but could it support doing the same thing asuseLoaderData
does - namely acceptingtypeof someLoader
as a generic argument?Beta Was this translation helpful? Give feedback.
All reactions