You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically if you return data() from loader/action, the type of const data = useLoaderData<typeof loader>() will incorrectly be of DataWithResponseInit.
The typescript LSP will suggest properties like .data etc are available, but they don't work as that's not actually what is returned.
Searching this repo, there are other similar issues, but they are marked as closed/fixed. Which doesn't make sense, as the issue is definitely not fixed.
Reproduction
Type safety seems messed up when returning
data
utility function from action/loader.Basically if you return
data()
from loader/action, the type ofconst data = useLoaderData<typeof loader>()
will incorrectly be ofDataWithResponseInit
.The typescript LSP will suggest properties like
.data
etc are available, but they don't work as that's not actually what is returned.Searching this repo, there are other similar issues, but they are marked as closed/fixed. Which doesn't make sense, as the issue is definitely not fixed.
unstable_data
conditionally #9998System Info
Used Package Manager
npm
Expected Behavior
Types should be returned correctly
Actual Behavior
Types returned incorrectly
The text was updated successfully, but these errors were encountered: