Better single fetch support for explicit loader/action return types #10244
aaronadamsCA
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We always define explicit return types, and single fetch is making this a bit tougher than it needs to be on our loaders and actions.
With
json()
deprecated in v2.14.0, we're updating our remaining actions to return plain objects where possible, anddata()
where necessary.Unfortunately this means
TypedResponse
is out, and sinceDataWithResponseInit
has not stabilized and is not re-exported by the Remix server runtime packages, for now we have to make it ourselves:An official solution would be great.
Just re-exporting
DataWithResponseInit
would be fine, but even better would be something likeSerializeTo<T>
(as a counterpart toSerializeFrom<T>
) that works whether you return a POJO ordata()
.Beta Was this translation helpful? Give feedback.
All reactions