-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(server-runtime): deprecate SerializeFrom
type
#10173
Conversation
🦋 Changeset detectedLatest commit: f222092 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
SerializeFrom
type
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
I'm not sure how to handle these cases without
And I have some here as well: https://github.com/search?q=repo%3Aepicweb-dev%2Fepicshop%20serializefrom&type=code Am I missing something? |
I was able to reproduce the behavior of type SerializeFrom<T> = ReturnType<typeof useLoaderData<T>>; It can be used in the same way as the current |
Thanks! That'll work I think. |
Please, please, please document this better! What a PITA to have to poke around to use such core functionality! |
To me it seems the current implementation in RR7 doesn't cover all the use cases which // Given these type definitions:
type SerializeFrom<T> = ReturnType<typeof useLoaderData<T>>;
type Car = {
…
price: Prisma.Decimal;
};
// 1)
type ResultDto = SerializeFrom<typeof loader>;
// 2)
type CarDto = SerializeFrom<Car>; Use case (1) still works since I upgraded from Remix to React Router (incl. migration to Single Fetch). But if I use it as shown in (2), If I look into the RR7 package, I see the following type definition for the return type of export type SerializeFrom<T> = T extends (...args: infer Args) => unknown
? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs]
? ClientDataFrom<T>
: ServerDataFrom<T>
: T; So if To work around the issue, I see that I could define type CarDto = SerializeFrom<typeof loader>["car"]; But I would like to avoid having to always use a specific |
No description provided.