ERROR in src/context/auth-context.tsx:57:9
TS2322: Type ‘Dispatch’ is not assignable to type ‘(…args: unknown[]) => Promise’.
Types of parameters ‘action’ and ‘args’ are incompatible.
Type ‘unknown’ is not assignable to type ‘AnyAction’.
55 |
56 | export const useAuth = () => {
57 | const dispatch: (…args: unknown[]) => Promise = useDispatch()
| ^^^^^^^^
58 | const user = useSelector(selectUser)
59 | const login = useCallback((form: AuthForm) => dispatch(authStore.login(form)), [dispatch])
60 | const register = useCallback((form: AuthForm) => dispatch(authStore.register(form)), [dispatch]
解锁 React17 高阶用法,轻松应对大型复杂长周期项目
了解课程