How to get type of loader data #1732
Answered
by
schiller-manuel
BrendanC23
asked this question in
Q&A
-
I have a component like this: function Parent() {
const route = getRouteApi("/");
const loaderData = route.useLoaderData();
return (<Child data={loaderData} />);
}
type ChildProps = {
data: SomeType; // What type is this?
};
function Child({ data }: ChildProps) {
return null;
} How can I get the type of I found this similar discussion, but it doesn't have a solution. |
Beta Was this translation helpful? Give feedback.
Answered by
schiller-manuel
May 21, 2025
Replies: 1 comment 8 replies
-
I'm also encountering this issue @BrendanC23 did you ever find a solution to this? Temporarily I've added |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can try to get the type of the loader data for a route like this:
just be aware this uses internal types that might change.