import { createStore } from "redux";
import * as storage from "redux-storage";
const reducer = storage.reducer((state, action) => ({}));
const store = createStore(reducer, {});
When using the above code with strict
enabled for typescript, I am receiving the following warning:
[ts] Argument of type 'Reducer<{}>' is not assignable to parameter of type 'Reducer<{}, AnyAction>'.
Types of parameters 'state' and 'state' are incompatible.
Type '{} | undefined' is not assignable to type '{}'.
Type 'undefined' is not assignable to type '{}'.
I understand what TS strict mode is, but I don't understand why it interprets my state as potentially undefined
What could I be doing wrong? Or how could I deal with the error without doing something lazy like as any
?