Skip to content

Commit 30e9171

Browse files
committed
Keep TS happy
1 parent 8ebeb98 commit 30e9171

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react-async/src/useAsync.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "./reducer"
1111

1212
import {
13+
AsyncAction,
1314
AsyncOptions,
1415
AsyncState,
1516
AbstractState,
@@ -60,7 +61,9 @@ function useAsync<T>(arg1: AsyncOptions<T> | PromiseFn<T>, arg2?: AsyncOptions<T
6061
const { devToolsDispatcher } = globalScope.__REACT_ASYNC__
6162
const { reducer, dispatcher = devToolsDispatcher } = options
6263
const [state, _dispatch] = useReducer(
63-
reducer ? (state, action) => reducer(state, action, asyncReducer) : asyncReducer,
64+
reducer
65+
? (state: AsyncState<T>, action: AsyncAction<T>) => reducer(state, action, asyncReducer)
66+
: asyncReducer,
6467
options,
6568
init
6669
)
@@ -336,5 +339,7 @@ const unsupported = () => {
336339
)
337340
}
338341

342+
// @ts-ignore
339343
export default useEffect ? useAsync : unsupported
344+
// @ts-ignore
340345
export const useFetch = useEffect ? useAsyncFetch : unsupported

0 commit comments

Comments
 (0)