Skip to content

Commit

Permalink
Merge pull request #501 from City-of-Helsinki/typescript-error-top-na…
Browse files Browse the repository at this point in the history
…vigation

MVJ-297 Typescript error top navigation
  • Loading branch information
robertrytovuori authored Jul 2, 2024
2 parents d6ab377 + 1e83779 commit 4686acd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/components/topNavigation/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
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";

// @ts-ignore: Type 'ReduxCompatibleReducer<TopNavigationState, TopNavigationSettings>' is not assignable to type 'Reducer<TopNavigationSettings>'.
const setSettingsReducer: Reducer<TopNavigationSettings> = handleActions({
const setSettingsReducer: Reducer<TopNavigationState> = handleActions({
['mvj/topnavigation/RECEIVE']: (state: TopNavigationState, {
payload: options
}: ReceiveTopNavigationSettingsAction) => {
Expand Down
16 changes: 6 additions & 10 deletions src/creditDecision/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const isFetchingHistoryByBusinessIdReducer: Reducer<IsFetchingHistoryMap> = hand
}: FetchHistoryByBusinessIdAction) => ({ ...state,
[id]: true
}),
// @ts-ignore: No overload matches this call

['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
}), {})
}),
Expand All @@ -35,11 +35,10 @@ const isFetchingHistoryByContactIdReducer: Reducer<IsFetchingHistoryMap> = handl
}: FetchHistoryByContactIdAction) => ({ ...state,
[id]: true
}),
// @ts-ignore: No overload matches this call
['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
}), {})
}),
Expand All @@ -62,11 +61,10 @@ const isFetchingCreditDecisionByBusinessIdReducer: Reducer<IsFetchingCreditDecis
}: FetchCreditDecisionByBusinessIdAction) => ({ ...state,
[id]: true
}),
// @ts-ignore: No overload matches this call
['mvj/creditDecision/RECEIVE_CREDIT_DECISION_BY_BUSINESS_ID']: (state: IsFetchingCreditDecisionMap, {
payload
}: ReceiveCreditDecisionByBusinessIdAction) => ({ ...state,
...Object.keys(payload).reduce((obj, key) => ({ ...obj,
...Object.keys(payload).reduce((obj: any, key) => ({ ...obj,
[key]: false
}), {})
}),
Expand All @@ -89,11 +87,10 @@ const isFetchingCreditDecisionByContactIdReducer: Reducer<IsFetchingCreditDecisi
}: FetchCreditDecisionByContactIdAction) => ({ ...state,
[id]: true
}),
// @ts-ignore: No overload matches this call
['mvj/creditDecision/RECEIVE_CREDIT_DECISION_BY_CONTACT_ID']: (state: IsFetchingCreditDecisionMap, {
payload
}: ReceiveCreditDecisionByContactIdAction) => ({ ...state,
...Object.keys(payload).reduce((obj, key) => ({ ...obj,
...Object.keys(payload).reduce((obj: any, key) => ({ ...obj,
[key]: false
}), {})
}),
Expand All @@ -116,11 +113,10 @@ const isFetchingCreditDecisionByNinReducer: Reducer<IsFetchingCreditDecisionMap>
}: FetchCreditDecisionByNinAction) => ({ ...state,
[id]: true
}),
// @ts-ignore: No overload matches this call
['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
}), {})
}),
Expand Down
4 changes: 2 additions & 2 deletions src/creditDecision/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export type CreditDecisionState = {
isFetchingHistoryByBusinessId: IsFetchingHistoryMap;
isFetchingHistoryByContactId: IsFetchingHistoryMap;
};
export type HistoryDataMap = Record<string, Record<string, any>>;
export type HistoryDataMap = Record<string, any>;
export type IsFetchingHistoryMap = Record<string, boolean>;
export type CreditDecisionDataMap = Record<string, Record<string, any>>;
export type CreditDecisionDataMap = Record<string, any>;
export type IsFetchingCreditDecisionMap = Record<string, boolean>;
export type FetchHistoryByBusinessIdAction = Action<string, string>;
export type FetchHistoryByContactIdAction = Action<string, string>;
Expand Down

0 comments on commit 4686acd

Please sign in to comment.