diff --git a/src/useSetState.ts b/src/useSetState.ts index 67b3db8fc3..056eaca6d4 100644 --- a/src/useSetState.ts +++ b/src/useSetState.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; -const useSetState = (initialState: T = {} as T): [T, (patch: Partial | (() => void)) => void] => { +const useSetState = (initialState: T = {} as T): [T, (patch: Partial | ((prevState: T) => Partial)) => void] => { const [state, set] = useState(initialState); const setState = patch => { set(prevState => Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch));