-
I have some problems with the latest update of Here is my loader: export const loader = async () => {
return {
requestedDomains: [
{ domain: "example.com", status: "pending" },
{ domain: "saulgoodman.org", status: "approved" },
{ domain: "example.org", status: "rejected", reason: "Not allowed" },
],
};
}; And const { requestedDomains } = useLoaderData<typeof loader>();
(SerializeObject<{
domain: string;
status: string;
reason?: undefined;
}> | SerializeObject<{
domain: string;
status: string;
reason: string;
}>)[] Shouldn't it be SerializeObject<{
domain: string;
status: string;
reason?: string;
}>[] ? This behaviour breaks my code because the type should be {
domain: string;
status: string;
reason?: string;
}[] |
Beta Was this translation helpful? Give feedback.
Answered by
pcattori
Oct 11, 2023
Replies: 2 comments 8 replies
-
If you want the new type inference to work, you have to do the following: // Type your loader args
export const loader = async ({ request } : LoaderArgs) => {}
// return your values with `json` helper
return json({ requestedDomains: [{}] }) |
Beta Was this translation helpful? Give feedback.
8 replies
-
As described in this comment, the behavior you are seeing is inherent to Typescript and is not a Remix issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
pcattori
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As described in this comment, the behavior you are seeing is inherent to Typescript and is not a Remix issue.