1
1
import {
2
- ComponentInt , ComponentsInt , PropInt , ChildInt ,
2
+ ComponentInt , ComponentsInt , PropInt , ChildInt , Action
3
3
} from '../utils/Interfaces.ts' ;
4
4
5
5
import {
@@ -35,10 +35,10 @@ import createApplicationUtil from '../utils/createApplication.util.ts';
35
35
36
36
export const changeImagePath = ( imageSource : string ) => ( {
37
37
type : CHANGE_IMAGE_SOURCE ,
38
- payload : imageSource ,
38
+ payload : { imageSource } ,
39
39
} )
40
40
41
- export const loadInitData = ( ) => ( dispatch : any ) => {
41
+ export const loadInitData = ( ) => ( dispatch : ( arg : Action ) => void ) => {
42
42
loadState ( ) . then ( ( data : any ) => dispatch ( {
43
43
type : LOAD_INIT_DATA ,
44
44
payload : {
@@ -47,7 +47,7 @@ export const loadInitData = () => (dispatch: any) => {
47
47
} ) ) ;
48
48
} ;
49
49
50
- export const addComponent = ( { title } : { title : string } ) => ( dispatch : any ) => {
50
+ export const addComponent = ( { title } : { title : string } ) => ( dispatch : ( arg : Action ) => void ) => {
51
51
dispatch ( { type : ADD_COMPONENT , payload : { title } } ) ;
52
52
} ;
53
53
@@ -59,11 +59,11 @@ export const addChild = ({
59
59
title : string ;
60
60
childType : string ;
61
61
HTMLInfo : object ;
62
- } ) => ( dispatch : any ) => {
62
+ } ) => ( dispatch : ( arg : Action ) => void ) => {
63
63
dispatch ( { type : ADD_CHILD , payload : { title, childType, HTMLInfo } } ) ;
64
64
} ;
65
65
66
- export const deleteChild = ( { } ) => ( dispatch : any ) => {
66
+ export const deleteChild = ( { } ) => ( dispatch : ( arg : Action ) => void ) => {
67
67
// with no payload, it will delete focusd child
68
68
dispatch ( { type : DELETE_CHILD , payload : { } } ) ;
69
69
} ;
@@ -74,7 +74,7 @@ export const deleteComponent = ({
74
74
} : {
75
75
componentId : number ;
76
76
stateComponents : ComponentsInt ;
77
- } ) => ( dispatch : any ) => {
77
+ } ) => ( dispatch : ( arg : Action ) => void ) => {
78
78
// find all places where the "to be deleted" is a child and do what u gotta do
79
79
stateComponents . forEach ( ( parent : ComponentInt ) => {
80
80
parent . childrenArray
@@ -97,12 +97,12 @@ stateComponents: ComponentsInt;
97
97
dispatch ( { type : DELETE_COMPONENT , payload : { componentId } } ) ;
98
98
} ;
99
99
100
- export const changeFocusComponent = ( { title } : { title : string } ) => ( dispatch : any ) => {
100
+ export const changeFocusComponent = ( { title } : { title : string } ) => ( dispatch : ( arg : Action ) => void ) => {
101
101
dispatch ( { type : CHANGE_FOCUS_COMPONENT , payload : { title } } ) ;
102
102
} ;
103
103
104
104
// make sure childId is being sent in
105
- export const changeFocusChild = ( { childId } : { childId : number } ) => ( dispatch : any ) => {
105
+ export const changeFocusChild = ( { childId } : { childId : number } ) => ( dispatch : ( arg : Action ) => void ) => {
106
106
dispatch ( { type : CHANGE_FOCUS_CHILD , payload : { childId } } ) ;
107
107
} ;
108
108
@@ -112,16 +112,15 @@ export const changeComponentFocusChild = ({
112
112
} : {
113
113
componentId : number ;
114
114
childId : number ;
115
- } ) => ( dispatch : any ) => {
115
+ } ) => ( dispatch : ( arg : Action ) => void ) => {
116
116
dispatch ( {
117
117
type : CHANGE_COMPONENT_FOCUS_CHILD ,
118
118
payload : { componentId, childId } ,
119
119
} ) ;
120
120
} ;
121
121
122
122
export const deleteImage = ( ) => ( {
123
- type : DELETE_IMAGE ,
124
- payload : ''
123
+ type : DELETE_IMAGE
125
124
} )
126
125
127
126
@@ -135,7 +134,7 @@ components: ComponentsInt;
135
134
path : string ;
136
135
appName : string ;
137
136
exportAppBool : boolean ;
138
- } ) => ( dispatch : any ) => {
137
+ } ) => ( dispatch : ( arg : Action ) => void ) => {
139
138
// this dispatch sets the global state property 'loading' to true until the createFiles call resolves below
140
139
dispatch ( {
141
140
type : EXPORT_FILES ,
@@ -187,7 +186,7 @@ components: ComponentsInt;
187
186
genOption : number ;
188
187
appName : string ;
189
188
exportAppBool : boolean ;
190
- } ) => ( dispatch : any ) => {
189
+ } ) => ( dispatch : ( arg : Action ) => void ) => {
191
190
if ( genOption === 0 ) {
192
191
exportAppBool = false ;
193
192
dispatch (
@@ -207,7 +206,6 @@ exportAppBool: boolean;
207
206
path,
208
207
appName,
209
208
genOption,
210
- // exportAppBool
211
209
} )
212
210
. then ( ( ) => {
213
211
dispatch ( {
@@ -238,7 +236,7 @@ export const deleteAllData = () => ({
238
236
type : DELETE_ALL_DATA ,
239
237
} ) ;
240
238
241
- export const deleteProp = ( propId : number ) => ( dispatch : any ) => {
239
+ export const deleteProp = ( propId : number ) => ( dispatch : ( arg : Action ) => void ) => {
242
240
dispatch ( { type : DELETE_PROP , payload : propId } ) ;
243
241
} ;
244
242
@@ -248,7 +246,7 @@ export const addProp = (prop: PropInt) => ({
248
246
} ) ;
249
247
250
248
export const updateHtmlAttr = ( { attr, value } : { attr : string ; value : string } ) => (
251
- dispatch : any ,
249
+ dispatch : ( arg : Action ) => void ,
252
250
) => {
253
251
dispatch ( {
254
252
type : UPDATE_HTML_ATTR ,
@@ -257,7 +255,7 @@ export const updateHtmlAttr = ({ attr, value }: { attr: string; value: string })
257
255
} ;
258
256
259
257
export const updateChildrenSort = ( { newSortValues } : { newSortValues : any } ) => (
260
- dispatch : any ,
258
+ dispatch : ( arg : Action ) => void ,
261
259
) => {
262
260
dispatch ( {
263
261
type : UPDATE_CHILDREN_SORT ,
0 commit comments