Skip to content

Commit

Permalink
Fix single fetch types for synchronous loader/action functions
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Apr 22, 2024
1 parent d3a5f38 commit 194788b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-trains-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/react": patch
---

[REMOVE] Fix return type when no promise is used
4 changes: 2 additions & 2 deletions packages/remix-react/future/single-fetch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ type DataFunctionReturnValue =

type LoaderFunction_SingleFetch = (
args: LoaderFunctionArgs
) => Promise<DataFunctionReturnValue>;
) => Promise<DataFunctionReturnValue> | DataFunctionReturnValue;
type ActionFunction_SingleFetch = (
args: ActionFunctionArgs
) => Promise<DataFunctionReturnValue>;
) => Promise<DataFunctionReturnValue> | DataFunctionReturnValue;

// Backwards-compatible type for Remix v2 where json/defer still use the old types,
// and only non-json/defer returns use the new types. This allows for incremental
Expand Down

0 comments on commit 194788b

Please sign in to comment.