@@ -128,7 +128,7 @@ const updateAllIds = (comp: Component[] | ChildElement[]) => {
128128 // put components' names and ids into an obj
129129 const obj = { spr : 1000 , others : 1 } ;
130130 // for each of the components, if it has children, iterate through that children array
131- comp . forEach ( ( el ) => {
131+ comp . forEach ( ( el : Component | ChildElement ) => {
132132 if ( el . children . length > 0 ) {
133133 for ( let i = 0 ; i < el . children . length ; i ++ ) {
134134 // update each child's childId
@@ -180,7 +180,7 @@ const deleteById = (id: number, name: string, state: State): Component[] => {
180180 const checkChildren = ( child : Component [ ] | ChildElement [ ] ) => {
181181 // for each of the components in the passed in components array, if the child
182182 // component has a children array, iterate through the array of children
183- child . forEach ( ( el ) => {
183+ child . forEach ( ( el : Component | ChildElement ) => {
184184 if ( el . children . length ) {
185185 const arr : ChildElement [ ] = [ ] ;
186186 for ( let i = 0 ; i < el . children . length ; i ++ ) {
@@ -206,7 +206,7 @@ const deleteById = (id: number, name: string, state: State): Component[] => {
206206 return updateIds ( filteredArr ) ;
207207} ;
208208
209- const updateUseStateCodes = ( currentComponent ) => {
209+ const updateUseStateCodes = ( currentComponent : Component | ChildElement ) => {
210210 // array of snippets of state prop codes
211211 const localStateCode : string [ ] = [ ] ; // avoid never by assigning it to string
212212 currentComponent . stateProps
@@ -359,7 +359,7 @@ const appStateSlice = createSlice({
359359 // if the newChild Element is an input or img type, delete the children key/value pair
360360 // if (newChild.name === 'input' && newChild.name === 'img')
361361 // delete newChild.children;
362- let directParent ;
362+ let directParent : HTMLElement | any ;
363363 if ( childId === null ) {
364364 if ( parentComponent ) {
365365 parentComponent . children . push ( topSeparator ) ;
@@ -417,7 +417,7 @@ const appStateSlice = createSlice({
417417 state . tailwind = action . payload ;
418418 } ,
419419 changeFocus : ( state , action ) => {
420- const { componentId, childId } = action . payload ;
420+ const { componentId, childId} = action . payload ;
421421 if ( childId < 1000 ) {
422422 // makes separators not selectable
423423 state . canvasFocus = { ...state . canvasFocus , componentId, childId } ;
@@ -894,7 +894,7 @@ const appStateSlice = createSlice({
894894 state . components [ focusIndex ] . past . length - 1
895895 ] ;
896896 // the last element of the past array gets popped off
897- const poppedEl = state . components [ focusIndex ] . past . pop ( ) ;
897+ const poppedEl : Component = state . components [ focusIndex ] . past . pop ( ) ;
898898 // the last element of the past array gets popped off and pushed into the future array
899899 state . components [ focusIndex ] . future . push ( poppedEl ) ;
900900 //generate code for the Code Preview
@@ -922,7 +922,7 @@ const appStateSlice = createSlice({
922922 state . components [ focusIndex ] . future . length - 1
923923 ] ;
924924 //the last element of the future array gets pushed into the past
925- const poppedEl = state . components [ focusIndex ] . future . pop ( ) ;
925+ const poppedEl : Component = state . components [ focusIndex ] . future . pop ( ) ;
926926 //the last element of the future array gets popped out
927927 state . components [ focusIndex ] . past . push ( poppedEl ) ;
928928 // generate code for the Code Preview
@@ -978,7 +978,7 @@ const appStateSlice = createSlice({
978978 }
979979
980980 //find the parent for deleting instances of where the parent is passing props to children
981- let parent ;
981+ let parent : Component ;
982982 for ( let i = 0 ; i < components . length ; i ++ ) {
983983 let currComponent = components [ i ] ;
984984 for ( let j = 0 ; j < currComponent . children . length ; j ++ ) {
@@ -1034,7 +1034,7 @@ const appStateSlice = createSlice({
10341034 ) ;
10351035
10361036 //find the parent of the component that we are deleting from
1037- let parent ;
1037+ let parent : Component ;
10381038 for ( let i = 0 ; i < components . length ; i ++ ) {
10391039 let currComponent = components [ i ] ;
10401040 for ( let j = 0 ; j < currComponent . children . length ; j ++ ) {
@@ -1046,8 +1046,8 @@ const appStateSlice = createSlice({
10461046 }
10471047
10481048 //deletes all instances of passedInProps from the children arrays of the current Component
1049- const deletePassedInPropsChildren = ( currComponent ) => {
1050- const innerFunc = ( currChild ) => {
1049+ const deletePassedInPropsChildren = ( currComponent : Component ) => {
1050+ const innerFunc = ( currChild : Component | ChildElement ) => {
10511051 // when there are no children, return up a level
10521052 if (
10531053 currChild . children . filter ( ( el ) => el . type === 'Component' )
@@ -1080,7 +1080,7 @@ const appStateSlice = createSlice({
10801080 ) ;
10811081 } ;
10821082 //delete from the components passedInProps array
1083- const deletePassedInProps = ( myComponent ) => {
1083+ const deletePassedInProps = ( myComponent : Component ) => {
10841084 if (
10851085 myComponent . children . filter ( ( el ) => el . type === 'Component' )
10861086 . length === 0
0 commit comments