Closed balzdur closed 8 months ago
ATM, the current return type of redirectBack is Response, making type inference messy when doing :
redirectBack
Response
const fetcher = useFetcher<typeof action>();
I changed the return type based on the one of redirect from Remix code
redirect
With my current code base were I spotted the issue
Before
After
This happen when you mix redirectBack with other return statements, like the following
export async function action({ request }: ActionFunctionArgs) { const formData = await request.formData(); const submission = parse(formData); if (!submission.isValid) { return json(submission); } return redirectBack(request, { fallback: getRoute('/scenarios/:scenarioId', { scenarioId: fromUUID(submission.value.scenarioId), }), }); }
Context
ATM, the current return type of
redirectBack
isResponse
, making type inference messy when doing :I changed the return type based on the one of
redirect
from Remix codeExample :
With my current code base were I spotted the issue
Before
After
This happen when you mix
redirectBack
with other return statements, like the following