From 7818378238b8013d87720ae6cffed81b06c92cbe Mon Sep 17 00:00:00 2001 From: Robert Rytovuori Date: Wed, 26 Jun 2024 09:24:59 +0300 Subject: [PATCH 1/4] fix typescript errors --- src/creditDecision/reducer.ts | 6 +----- src/creditDecision/types.ts | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/creditDecision/reducer.ts b/src/creditDecision/reducer.ts index 9d7f7ff8e..7b40f31bd 100644 --- a/src/creditDecision/reducer.ts +++ b/src/creditDecision/reducer.ts @@ -8,7 +8,7 @@ const isFetchingHistoryByBusinessIdReducer: Reducer = hand }: FetchHistoryByBusinessIdAction) => ({ ...state, [id]: true }), - // @ts-ignore: No overload matches this call + ['mvj/creditDecision/RECEIVE_HISTORY_BY_BUSINESS_ID']: (state: IsFetchingHistoryMap, { payload }: ReceiveHistoryByBusinessIdAction) => ({ ...state, @@ -35,7 +35,6 @@ const isFetchingHistoryByContactIdReducer: Reducer = handl }: FetchHistoryByContactIdAction) => ({ ...state, [id]: true }), - // @ts-ignore: No overload matches this call ['mvj/creditDecision/RECEIVE_HISTORY_BY_CONTACT_ID']: (state: IsFetchingHistoryMap, { payload }: ReceiveHistoryByContactIdAction) => ({ ...state, @@ -62,7 +61,6 @@ const isFetchingCreditDecisionByBusinessIdReducer: Reducer ({ ...state, [id]: true }), - // @ts-ignore: No overload matches this call ['mvj/creditDecision/RECEIVE_CREDIT_DECISION_BY_BUSINESS_ID']: (state: IsFetchingCreditDecisionMap, { payload }: ReceiveCreditDecisionByBusinessIdAction) => ({ ...state, @@ -89,7 +87,6 @@ const isFetchingCreditDecisionByContactIdReducer: Reducer ({ ...state, [id]: true }), - // @ts-ignore: No overload matches this call ['mvj/creditDecision/RECEIVE_CREDIT_DECISION_BY_CONTACT_ID']: (state: IsFetchingCreditDecisionMap, { payload }: ReceiveCreditDecisionByContactIdAction) => ({ ...state, @@ -116,7 +113,6 @@ const isFetchingCreditDecisionByNinReducer: Reducer }: FetchCreditDecisionByNinAction) => ({ ...state, [id]: true }), - // @ts-ignore: No overload matches this call ['mvj/creditDecision/RECEIVE_CREDIT_DECISION_BY_NIN']: (state: IsFetchingCreditDecisionMap, { payload }: ReceiveCreditDecisionByNinAction) => ({ ...state, diff --git a/src/creditDecision/types.ts b/src/creditDecision/types.ts index 6ac133e6b..f93c08dc0 100644 --- a/src/creditDecision/types.ts +++ b/src/creditDecision/types.ts @@ -11,9 +11,9 @@ export type CreditDecisionState = { isFetchingHistoryByBusinessId: IsFetchingHistoryMap; isFetchingHistoryByContactId: IsFetchingHistoryMap; }; -export type HistoryDataMap = Record>; +export type HistoryDataMap = any; export type IsFetchingHistoryMap = Record; -export type CreditDecisionDataMap = Record>; +export type CreditDecisionDataMap = any; export type IsFetchingCreditDecisionMap = Record; export type FetchHistoryByBusinessIdAction = Action; export type FetchHistoryByContactIdAction = Action; From 1f4958056b63f9d9483f61030e649934bcaf97ac Mon Sep 17 00:00:00 2001 From: Robert Rytovuori Date: Thu, 27 Jun 2024 09:32:24 +0300 Subject: [PATCH 2/4] moving any away from types and closer to problem creditDecision --- src/creditDecision/reducer.ts | 10 +++++----- src/creditDecision/types.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/creditDecision/reducer.ts b/src/creditDecision/reducer.ts index 7b40f31bd..b72a074a0 100644 --- a/src/creditDecision/reducer.ts +++ b/src/creditDecision/reducer.ts @@ -12,7 +12,7 @@ const isFetchingHistoryByBusinessIdReducer: Reducer = hand ['mvj/creditDecision/RECEIVE_HISTORY_BY_BUSINESS_ID']: (state: IsFetchingHistoryMap, { payload }: ReceiveHistoryByBusinessIdAction) => ({ ...state, - ...Object.keys(payload).reduce((obj, key) => ({ ...obj, + ...Object.keys(payload).reduce((obj: any, key) => ({ ...obj, [key]: false }), {}) }), @@ -38,7 +38,7 @@ const isFetchingHistoryByContactIdReducer: Reducer = handl ['mvj/creditDecision/RECEIVE_HISTORY_BY_CONTACT_ID']: (state: IsFetchingHistoryMap, { payload }: ReceiveHistoryByContactIdAction) => ({ ...state, - ...Object.keys(payload).reduce((obj, key) => ({ ...obj, + ...Object.keys(payload).reduce((obj: any, key) => ({ ...obj, [key]: false }), {}) }), @@ -64,7 +64,7 @@ const isFetchingCreditDecisionByBusinessIdReducer: Reducer ({ ...state, - ...Object.keys(payload).reduce((obj, key) => ({ ...obj, + ...Object.keys(payload).reduce((obj: any, key) => ({ ...obj, [key]: false }), {}) }), @@ -90,7 +90,7 @@ const isFetchingCreditDecisionByContactIdReducer: Reducer ({ ...state, - ...Object.keys(payload).reduce((obj, key) => ({ ...obj, + ...Object.keys(payload).reduce((obj: any, key) => ({ ...obj, [key]: false }), {}) }), @@ -116,7 +116,7 @@ const isFetchingCreditDecisionByNinReducer: Reducer ['mvj/creditDecision/RECEIVE_CREDIT_DECISION_BY_NIN']: (state: IsFetchingCreditDecisionMap, { payload }: ReceiveCreditDecisionByNinAction) => ({ ...state, - ...Object.keys(payload).reduce((obj, key) => ({ ...obj, + ...Object.keys(payload).reduce((obj: any, key) => ({ ...obj, [key]: false }), {}) }), diff --git a/src/creditDecision/types.ts b/src/creditDecision/types.ts index f93c08dc0..76c141543 100644 --- a/src/creditDecision/types.ts +++ b/src/creditDecision/types.ts @@ -11,9 +11,9 @@ export type CreditDecisionState = { isFetchingHistoryByBusinessId: IsFetchingHistoryMap; isFetchingHistoryByContactId: IsFetchingHistoryMap; }; -export type HistoryDataMap = any; +export type HistoryDataMap = Record; export type IsFetchingHistoryMap = Record; -export type CreditDecisionDataMap = any; +export type CreditDecisionDataMap = Record; export type IsFetchingCreditDecisionMap = Record; export type FetchHistoryByBusinessIdAction = Action; export type FetchHistoryByContactIdAction = Action; From 97a1809b123342c1ef17c8575bc7aa8ac7c48c5d Mon Sep 17 00:00:00 2001 From: Robert Rytovuori Date: Thu, 27 Jun 2024 10:02:56 +0300 Subject: [PATCH 3/4] change TopNavigationSetting to TopNavigationState in setSettingsReducer --- src/components/topNavigation/reducer.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/topNavigation/reducer.ts b/src/components/topNavigation/reducer.ts index 88da3fbe0..436da6c78 100644 --- a/src/components/topNavigation/reducer.ts +++ b/src/components/topNavigation/reducer.ts @@ -3,8 +3,7 @@ import { handleActions } from "redux-actions"; import type { Reducer } from "types"; import type { ReceiveTopNavigationSettingsAction, TopNavigationSettings, TopNavigationState } from "./types"; -// @ts-ignore: Type 'ReduxCompatibleReducer' is not assignable to type 'Reducer'. -const setSettingsReducer: Reducer = handleActions({ +const setSettingsReducer: Reducer = handleActions({ ['mvj/topnavigation/RECEIVE']: (state: TopNavigationState, { payload: options }: ReceiveTopNavigationSettingsAction) => { From 1e8377900c2c2c24a8d0435a6a6149e7110177b4 Mon Sep 17 00:00:00 2001 From: Robert Rytovuori Date: Tue, 2 Jul 2024 14:10:06 +0300 Subject: [PATCH 4/4] remove unused import --- src/components/topNavigation/reducer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/topNavigation/reducer.ts b/src/components/topNavigation/reducer.ts index 436da6c78..36d624f28 100644 --- a/src/components/topNavigation/reducer.ts +++ b/src/components/topNavigation/reducer.ts @@ -1,7 +1,7 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Reducer } from "types"; -import type { ReceiveTopNavigationSettingsAction, TopNavigationSettings, TopNavigationState } from "./types"; +import type { ReceiveTopNavigationSettingsAction, TopNavigationState } from "./types"; const setSettingsReducer: Reducer = handleActions({ ['mvj/topnavigation/RECEIVE']: (state: TopNavigationState, {