Currently, I am in the process of setting up a redux store using the code snippet below.
import { createStore, Action } from "redux";
interface State {
page: string;
}
const updater = (currentState: State, action: Action) => {
return currentState;
};
export const storage = createStore(updater);
However, I've encountered an issue with the createStore
function. The error message states that:
No suitable overload exists for this call.
Overload 1 of 2, '(updater: Updater<State, Action<any>>, enhancer?: Enhancer<unknown, unknown> | undefined): Storage<State, Action<...>>', caused the following error.
Argument of type '(currentState: State, action: Action) => State' is not compatible with parameter of type 'Updater<State, Action<any>>'.
Incompatible types for parameters 'currentState' and 'state'.
Type 'State | undefined' cannot be assigned to type 'State'.
Type 'undefined' cannot be assigned to type 'State'.
Overload 2 of 2, '(updater: Updater<State, Action<any>>, initialState?: { page: string; } | undefined, enhancer?: Enhancer<unknown, {}> | undefined): Storage<...>', led to the following error.
Argument of type '(currentState: State, action: Action) => State' is not compatible with parameter of type 'Updater<State, Action<any>>'.
The version of Redux being used is ^4.1.0
.