-
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
data utility does not pass types the same as json #10407
Comments
I managed to fix the initial problem of the data type being incorrect by doing the following step: https://remix.run/docs/en/main/guides/single-fetch#enable-single-fetch-types But after that I have another issue: There is an old PR that fixes a similar issue for the |
@eliashelleborn is correct. To use the |
@brookslybrand Should I open a separate issue for the other type-error I'm running into? Or do you have ideas on what could cause this. This happens after declaring the Future type. |
@eliashelleborn yes, if you can open that with a reproduction that would be very helpful |
I am running into the same issue as @eliashelleborn while trying to upgrade remix. When I swap the
It happens both for actions and loaders where I swap the helper. Any way to fix this? |
@douweknook if there's not already an issue open will you please open one with a reproduction? |
I've tried to reproduce this in the StackBlitz without success so far unfortunately 😕 |
Reproduction
Follow react-router docs on Form Validation
Notice that the types of
useFetcher().data
(oruseActionData
if you use that instead) areany
instead of includingerrors
as was done withjson
This issue is also described in this discussion
When attempting to do a reproduction in [integration/bug-report-test.ts](https://github.com/remix-run/remix/blob/dev/integration/bug-report-test.ts) I noticed that is still using
json
instead ofdata
even thoughjson
is marked as deprecatedSystem Info
Used Package Manager
yarn
Expected Behavior
It is expected that
data
would correctly type response data as happens withjson
or if you return an object directly within an action/loaderActual Behavior
useFetcher().data and useActionData do not correctly contain types when
data
is used as it did previously withjson
(now marked as deprecated)As mentioned this is also described in this discussion
The text was updated successfully, but these errors were encountered: