Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit 8a5ca2f

Browse files
committed
Update types for redux v4
1 parent 60ddb4a commit 8a5ca2f

15 files changed

Lines changed: 43 additions & 43 deletions

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"react-redux": "^5.0.2",
3131
"react-router-dom": "^4.0.0-beta.8",
3232
"reactivexcomponent.js": "^6.0.0",
33-
"redux": "^4.0.0",
33+
"redux": "^4.0.1",
3434
"redux-logger": "^3.0.0",
35-
"redux-thunk": "^2.2.0"
35+
"redux-thunk": "^2.3.0"
3636
},
3737
"devDependencies": {
3838
"jasmine-reporters": "^2.2.0",

src/actions/components.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Action } from "redux";
22
import { ComponentProperties } from "reducers/components";
3-
import { ThunkAction } from "redux-thunk";
43
import { Dispatch } from "redux";
54
import { XCSpyState } from "reducers/spyReducer";
65
import { snapshotEntryPoint, subscribeAllStateMachines } from "../core";
@@ -43,8 +42,8 @@ export const initialization = (componentProperties: { [componentName: string]: C
4342
};
4443

4544

46-
export const updateGraphic = (component: string, stateMachine: string, data: StateMachineInstance): ThunkAction<void, XCSpyState, void> => {
47-
return (dispatch: Dispatch<XCSpyState>, getState: () => XCSpyState): void => {
45+
export const updateGraphic = (component: string, stateMachine: string, data: StateMachineInstance): (dispatch: Dispatch<Action<any>>, getState: () => XCSpyState) => void => {
46+
return (dispatch: Dispatch<Action>, getState: () => XCSpyState): void => {
4847
dispatch({
4948
type: UPDATE_GRAPHIC,
5049
component,
@@ -72,14 +71,14 @@ export const setAutoClear = (autoClear: boolean): SetAutoClearAction => {
7271
};
7372
};
7473

75-
export const subscribeAllStateMachinesAction = (component: string, stateMachines: string[]): ThunkAction<void, XCSpyState, void> => {
76-
return (dispatch: Dispatch<XCSpyState>): void => {
74+
export const subscribeAllStateMachinesAction = (component: string, stateMachines: string[]): (dispatch: Dispatch<Action>) => void => {
75+
return (dispatch: Dispatch<Action>): void => {
7776
subscribeAllStateMachines(dispatch, component, stateMachines);
7877
};
7978
};
8079

81-
export const snapshotEntryPointAction = (component: string, entryPoint: string): ThunkAction<void, XCSpyState, void> => {
82-
return (dispatch: Dispatch<XCSpyState>): void => {
80+
export const snapshotEntryPointAction = (component: string, entryPoint: string): (dispatch: Dispatch<Action>) => void => {
81+
return (dispatch: Dispatch<Action>): void => {
8382
snapshotEntryPoint(dispatch, component, entryPoint);
8483
};
8584
};

src/actions/compositionModel.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import xcomponentapi from "reactivexcomponent.js";
22
import { Action } from "redux";
3-
import { ThunkAction } from "redux-thunk";
43
import { getCompositionModel } from "../core";
54
import { Dispatch } from "redux";
65
import { XCSpyState } from "reducers/spyReducer";
@@ -19,8 +18,8 @@ export const initCompositionModelAction = (compositionModel): GlobalCompositionM
1918
};
2019
};
2120

22-
export const setCompositionModel = (xcApiName: string, serverUrl: string): ThunkAction<void, void, void> => {
23-
return (dispatch: Dispatch<XCSpyState>): void => {
21+
export const setCompositionModel = (xcApiName: string, serverUrl: string): (dispatch: Dispatch<Action<any>>) => void => {
22+
return (dispatch: Dispatch<Action>): void => {
2423
getCompositionModel(dispatch, xcApiName, serverUrl);
2524
};
2625
};

src/actions/stateMachineProperties.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Action } from "redux";
22
import { Dispatch } from "redux";
33
import { XCSpyState } from "reducers/spyReducer";
4-
import { ThunkAction } from "redux-thunk";
54
import { snapshot, snapshotAll } from "../core";
65

76
export const SHOW_STATE_MACHINE_PROPERTIES = "SHOW_STATE_MACHINE_PROPERTIES ";
@@ -19,8 +18,8 @@ export interface SetStateMachineIdAction extends Action {
1918
id: string;
2019
}
2120

22-
export const showStateMachineProperties = (component: string, stateMachine: string): ThunkAction<void, XCSpyState, void> => {
23-
return (dispatch: Dispatch<XCSpyState>, getState: () => XCSpyState) => {
21+
export const showStateMachineProperties = (component: string, stateMachine: string): (dispatch: Dispatch<Action<any>>, getState: () => XCSpyState) => void => {
22+
return (dispatch: Dispatch<Action>, getState: () => XCSpyState) => {
2423
const componentProperties = getState().components.componentProperties;
2524
const firstId = Object.keys(componentProperties[component].stateMachineProperties[stateMachine])[0];
2625
dispatch({
@@ -44,14 +43,14 @@ export const setStateMachineId = (id): SetStateMachineIdAction => {
4443
};
4544
};
4645

47-
export const snapshotAction = (currentComponent: string, stateMachine: string): ThunkAction<void, XCSpyState, void> => {
48-
return (dispatch: Dispatch<XCSpyState>): void => {
46+
export const snapshotAction = (currentComponent: string, stateMachine: string): (dispatch: Dispatch<Action<any>>, getState: () => XCSpyState) => void => {
47+
return (dispatch: Dispatch<Action>): void => {
4948
snapshot(dispatch, currentComponent, stateMachine);
5049
};
5150
};
5251

53-
export const snapshotAllAction = (currentComponent: string, stateMachines: string[]): ThunkAction<void, XCSpyState, void> => {
54-
return (dispatch: Dispatch<XCSpyState>): void => {
52+
export const snapshotAllAction = (currentComponent: string, stateMachines: string[]): (dispatch: Dispatch<Action<any>>, getState: () => XCSpyState) => void => {
53+
return (dispatch: Dispatch<Action>): void => {
5554
snapshotAll(dispatch, currentComponent, stateMachines);
5655
};
5756
};

src/actions/transitionProperties.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Action } from "redux";
22
import { Dispatch } from "redux";
33
import { XCSpyState } from "reducers/spyReducer";
44
import sessionXCSpy, { SessionXCSpy } from "../utils/sessionXCSpy";
5-
import { ThunkAction } from "redux-thunk";
65
import { StateMachineRef, Session } from "reactivexcomponent.js";
76

87
export const SHOW_TRANSITION_PROPERTIES = "SHOW_TRANSITION_PROPERTIES";
@@ -54,8 +53,8 @@ export interface SendContextAction extends Action {
5453
privateTopic: string;
5554
}
5655

57-
export const showTransitionProperties = (component: string, stateMachine: string, messageType: string, jsonMessageString: string): ThunkAction<void, XCSpyState, void> => {
58-
return (dispatch: Dispatch<XCSpyState>, getState: () => XCSpyState) => {
56+
export const showTransitionProperties = (component: string, stateMachine: string, messageType: string, jsonMessageString: string): (dispatch: Dispatch<Action<any>>, getState: () => XCSpyState) => void => {
57+
return (dispatch: Dispatch<Action>, getState: () => XCSpyState) => {
5958
sessionXCSpy.PromiseCreateSession
6059
.then((session: Session) => {
6160
if (session.canSend(component, stateMachine, messageType)) {

src/components/AppHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { connect } from "react-redux";
1111
import { showSideBar, hideSideBar } from "../actions/sideBar";
1212
import { updateGraphic, clearFinalStates, setAutoClear, snapshotAllAction, logout } from "../actions";
1313
import { XCSpyState } from "../reducers/spyReducer";
14-
import { Dispatch } from "redux";
14+
import { Dispatch, Action } from "redux";
1515
import { snapshotAll } from "core";
1616
import { BrowserRouter as Router, Route, Link, withRouter, Redirect } from "react-router-dom";
1717
import { routes } from "../utils/routes";
@@ -57,7 +57,7 @@ const mapStateToProps = (state: XCSpyState, ownProps): AppHeaderProps => {
5757
};
5858
};
5959

60-
const mapDispatchToProps = (dispatch: Dispatch<XCSpyState>, ownProps): AppHeaderCallbackProps => {
60+
const mapDispatchToProps = (dispatch, ownProps): AppHeaderCallbackProps => {
6161
return {
6262
returnHome: (): void => {
6363
dispatch(logout());

src/components/Components.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as go from "../gojs/go";
1010
import * as Title from "grommet/components/Title";
1111
import * as Button from "grommet/components/Button";
1212
import { backgroundColor } from "../utils/graphicColors";
13-
import { Dispatch } from "redux";
13+
import { Dispatch, Action } from "redux";
1414
import { XCSpyState } from "../reducers/spyReducer";
1515
import { ComponentProperties } from "../reducers/components";
1616
import * as Box from "grommet/components/Box";
@@ -49,7 +49,7 @@ const mapStateToProps = (state: XCSpyState, ownProps): ComponentsProps => {
4949
};
5050
};
5151

52-
const mapDispatchToProps = (dispatch: Dispatch<XCSpyState>): ComponentsCallbackProps => {
52+
const mapDispatchToProps = (dispatch): ComponentsCallbackProps => {
5353
return {
5454
initialization: (componentProperties: { [componentName: string]: ComponentProperties }, currentComponent: string, projectName: string): void => {
5555
dispatch(initialization(componentProperties, currentComponent, projectName));

src/components/ConfigForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const mapStateToProps = (state: XCSpyState, ownProps): ConfigFormProps => {
4646
};
4747
};
4848

49-
const mapDispatchToProps = (dispatch: Dispatch<Action>, ownProps): ConfigFormCallbackProps => {
49+
const mapDispatchToProps = (dispatch, ownProps): ConfigFormCallbackProps => {
5050
return {
5151
onClickGetApiList: (serverUrl: string): void => {
5252
dispatch(getApiList(serverUrl));

src/components/SideBar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { XCSpyState } from "../reducers/spyReducer";
1616
import { Dispatch } from "redux";
1717
import { Link, withRouter } from "react-router-dom";
1818
import { routes } from "../utils/routes";
19+
import { Action } from "redux";
1920

2021
interface SideBarGlobalProps extends SideBarProps, SideBarCallbackProps {
2122
}
@@ -50,7 +51,7 @@ const mapStateToProps = (state: XCSpyState, ownProps): SideBarProps => {
5051
};
5152
};
5253

53-
const mapDispatchToProps = (dispatch: Dispatch<XCSpyState>): SideBarCallbackProps => {
54+
const mapDispatchToProps = (dispatch: Dispatch<Action>): SideBarCallbackProps => {
5455
return {
5556
hideSideBar: () => {
5657
dispatch(hideSideBar());

src/components/StateMachineProperties.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { routes } from "../utils/routes";
2020
import { StateMachineRef } from "reactivexcomponent.js";
2121
import { injectIntl, InjectedIntl } from "react-intl";
2222
import * as CloseIcon from "grommet/components/icons/base/Close";
23+
import { Action } from "redux";
2324

2425
interface StateMachinePropertiesGlobalProps extends StateMachinePropertiesProps, StateMachinePropertiesCallbackProps {
2526
}
@@ -66,7 +67,7 @@ const mapStateToProps = (state: XCSpyState, ownProps): StateMachinePropertiesPro
6667
};
6768
};
6869

69-
const mapDispatchToProps = (dispatch: Dispatch<XCSpyState>): StateMachinePropertiesCallbackProps => {
70+
const mapDispatchToProps = (dispatch): StateMachinePropertiesCallbackProps => {
7071
return {
7172
clearFinalStates: (component: string, stateMachine: string): void => {
7273
dispatch(clearFinalStates(component, stateMachine));

0 commit comments

Comments
 (0)