Argument of type is not assignable to parameter of type 'never' mapDispatchToProps

Viewed 55

I have a typescript error, which i cannot figure out. I get this "Argument of type is not assignable to parameter of type 'never'" error. I have read about this error message, but cant figure out how to solve my issue anyway. So i have the following code:

My reducercode:

export const setInfoGDPRAction = createAction(InfoActionTypes.SET_GDPR, (resolve) => (acceptedgdpr: boolean) => resolve(acceptedgdpr));

Then in my hooks-component:

type Action = ActionType<typeof actions>; // (when i hover this it says Action = never)

const mapStateToProps = (state: ApplicationState): RootProps => ({
    data: state.data,
} as RootProps);

const mapDispatchToProps = (dispatch: React.Dispatch<Action>, props: RootProps): RootProps => ({
    setGDPRData: (accepted: boolean) => dispatch(actions.setInfoGDPRAction(accepted)),
} as RootProps);

export default connect(mapStateToProps, mapDispatchToProps)(Root);

Can anyone tell me how i can write this so it will work? :) Thanks.

0 Answers
Related