@@ -20,7 +20,7 @@ import getLinkComponent from './getLinkComponent';
20
20
import { toggleExpanded , setCurrentTabInApp } from '../../../actions/actions' ;
21
21
import { useStoreContext } from '../../../store' ;
22
22
23
- const defaultMargin = {
23
+ const defaultMargin : { } = {
24
24
top : 30 ,
25
25
left : 30 ,
26
26
right : 55 ,
@@ -95,7 +95,7 @@ export default function ComponentMap({
95
95
scroll : true ,
96
96
} ) ;
97
97
98
- const tooltipStyles = {
98
+ const tooltipStyles : { } = {
99
99
...defaultStyles ,
100
100
minWidth : 60 ,
101
101
maxWidth : 300 ,
@@ -108,7 +108,7 @@ export default function ComponentMap({
108
108
pointerEvents : 'all !important' ,
109
109
} ;
110
110
111
- const scrollStyle = {
111
+ const scrollStyle : { } = {
112
112
minWidth : '60' ,
113
113
maxWidth : '300' ,
114
114
minHeight : '20px' ,
@@ -117,13 +117,13 @@ export default function ComponentMap({
117
117
overflowWrap : 'break-word' ,
118
118
} ;
119
119
120
- const formatRenderTime = ( time : number ) : string => {
120
+ const formatRenderTime : string = ( time : number ) : string => {
121
121
const renderTime = time . toFixed ( 3 ) ;
122
122
return `${ renderTime } ms ` ;
123
123
} ;
124
124
125
- const formatData = ( data , type ) => {
126
- const contextFormat = [ ] ;
125
+ const formatData : [ ] = ( data , type ) => {
126
+ const contextFormat : string [ ] = [ ] ;
127
127
for ( const key in data ) {
128
128
// Suggestion: update the front end to display as a list if we have object
129
129
let inputData = data [ key ] ;
@@ -135,15 +135,15 @@ export default function ComponentMap({
135
135
return contextFormat ;
136
136
} ;
137
137
138
- const formatState = ( state ) => {
138
+ const formatState : string [ ] = ( state ) => {
139
139
if ( state === 'stateless' ) return [ 'stateless' ] ;
140
140
return [ 'stateful' ] ;
141
141
} ;
142
142
143
143
// places all nodes into a flat array
144
- const nodeList = [ ] ;
144
+ const nodeList : [ ] = [ ] ;
145
145
146
- const collectNodes = ( node ) => {
146
+ const collectNodes : void = ( node ) => {
147
147
nodeList . splice ( 0 , nodeList . length ) ;
148
148
nodeList . push ( node ) ;
149
149
for ( let i = 0 ; i < nodeList . length ; i += 1 ) {
@@ -170,7 +170,7 @@ export default function ComponentMap({
170
170
findSelectedNode ( ) ;
171
171
172
172
// controls for the map
173
- const LinkComponent = getLinkComponent ( { layout, linkType, orientation } ) ;
173
+ const LinkComponent : React . ComponentType < unknown > = getLinkComponent ( { layout, linkType, orientation } ) ;
174
174
return totalWidth < 10 ? null : (
175
175
< div >
176
176
< LinkControls
@@ -218,14 +218,14 @@ export default function ComponentMap({
218
218
) ) }
219
219
220
220
{ tree . descendants ( ) . map ( ( node , key ) => {
221
- const widthFunc = ( name ) => {
221
+ const widthFunc : number = ( name ) => {
222
222
const nodeLength = name . length ;
223
223
if ( nodeLength < 5 ) return nodeLength + 40 ;
224
224
if ( nodeLength < 10 ) return nodeLength + 60 ;
225
225
return nodeLength + 70 ;
226
226
} ;
227
- const width = widthFunc ( node . data . name ) ;
228
- const height = 25 ;
227
+ const width : number = widthFunc ( node . data . name ) ;
228
+ const height : number = 25 ;
229
229
230
230
let top : number ;
231
231
let left : number ;
@@ -242,7 +242,7 @@ export default function ComponentMap({
242
242
}
243
243
244
244
// mousing controls & Tooltip display logic
245
- const handleMouseAndClickOver = ( event ) => {
245
+ const handleMouseAndClickOver : void = ( event ) => {
246
246
const coords = localPoint ( event . target . ownerSVGElement , event ) ;
247
247
const tooltipObj = { ...node . data } ;
248
248
0 commit comments