I am getting this error can anyone help ?

This is the type definition of IStoreState
export interface IStoreState {
languageName: string;
enthusiasmLevel: number;
}
Is it duplicate to https://github.com/Microsoft/TypeScript-React-Starter/issues/136?
Not sure if this is the solution to it, but this worked for me
I imported EnthusiasmAction
import { EnthusiasmAction } from './actions/index';
and used like below
const store = createStore
enthusiasmLevel: 1,
languageName: 'TypeScript'
});
If don't know what the type is, try to describe it as 'any'
const store = createStore
enthusiasmLevel: 1,
languageName: 'TypeScript',
});
Didn't work, why it's closed and readme not updated
The solution presented by @haani104 is good, but for me was incomplete, i had to make tihis change in my /reducers/index.tsx:
import { Reducer } from "redux";
export const enthusiasm: Reducer = (
state: StoreState,
action: EnthusiasmAction
): StoreState => {
switch (action.type) {
case INCREMENT_ENTHUSIASM:
return { ...state, enthusiasmLevel: state.enthusiasmLevel + 1 };
case DECREMENT_ENTHUSIASM:
return { ...state, enthusiasmLevel: state.enthusiasmLevel - 1 };
}
return state;
};
Basically, createStore expects a function of type Reducer as one of it arguments, and in the tutorial, we are declaring it as a plain function.
Most helpful comment
Not sure if this is the solution to it, but this worked for me
I imported EnthusiasmAction
import { EnthusiasmAction } from './actions/index';
and used like below
const store = createStore(enthusiam, {
enthusiasmLevel: 1,
languageName: 'TypeScript'
});