@@ -167,17 +167,23 @@ describe("Directed hierarchical layout", (): void => {
167167 const configs = [
168168 { nodes : [ ] , swallowsEdges : 0 } ,
169169 ...( clusterConfigs || [ ] ) ,
170- ] . map ( ( { nodes } , i , arr ) : {
171- expectedVisibleEdges : number ;
172- nodesToCluster : Set < IdType > ;
173- } => ( {
174- expectedVisibleEdges :
175- data . edges . length -
170+ ] . map (
171+ (
172+ { nodes } ,
173+ i ,
176174 arr
177- . slice ( 0 , i + 1 )
178- . reduce ( ( acc , { swallowsEdges } ) : number => acc + swallowsEdges , 0 ) ,
179- nodesToCluster : new Set ( nodes ) ,
180- } ) ) ;
175+ ) : {
176+ expectedVisibleEdges : number ;
177+ nodesToCluster : Set < IdType > ;
178+ } => ( {
179+ expectedVisibleEdges :
180+ data . edges . length -
181+ arr
182+ . slice ( 0 , i + 1 )
183+ . reduce ( ( acc , { swallowsEdges } ) : number => acc + swallowsEdges , 0 ) ,
184+ nodesToCluster : new Set ( nodes ) ,
185+ } )
186+ ) ;
181187
182188 describe ( name , ( ) : void => {
183189 it ( "Preparation" , ( ) : void => {
@@ -244,28 +250,40 @@ describe("Directed hierarchical layout", (): void => {
244250 * No matter how much ESLint think they're unnecessary, these two
245251 * assertions are indeed necessary.
246252 */
247- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
248- const visibleEdges = ( Object . values (
249- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
250- ( network as any ) . body . edges
251- ) as any [ ] ) . filter (
253+ const visibleEdges = Object . values (
254+ (
255+ network as unknown as {
256+ body : {
257+ edges : {
258+ fromId : string ;
259+ toId : string ;
260+ } [ ] ;
261+ } ;
262+ }
263+ ) . body . edges
264+ ) . filter (
252265 ( edge ) : boolean =>
253266 visibleNodeIds . has ( edge . fromId ) &&
254267 visibleNodeIds . has ( edge . toId )
255268 ) ;
256269
257270 const invalidEdges = visibleEdges
258- . map ( ( { fromId, toId } ) : {
259- fromId : IdType ;
260- fromPosition : Point ;
261- toId : IdType ;
262- toPosition : Point ;
263- } => ( {
264- fromId,
265- fromPosition : network . getPositions ( [ fromId ] ) [ fromId ] ,
266- toId,
267- toPosition : network . getPositions ( [ toId ] ) [ toId ] ,
268- } ) )
271+ . map (
272+ ( {
273+ fromId,
274+ toId,
275+ } ) : {
276+ fromId : IdType ;
277+ fromPosition : Point ;
278+ toId : IdType ;
279+ toPosition : Point ;
280+ } => ( {
281+ fromId,
282+ fromPosition : network . getPositions ( [ fromId ] ) [ fromId ] ,
283+ toId,
284+ toPosition : network . getPositions ( [ toId ] ) [ toId ] ,
285+ } )
286+ )
269287 . filter ( ( { fromPosition, toPosition } ) : boolean => {
270288 return ! ( fromPosition . y < toPosition . y ) ;
271289 } ) ;
0 commit comments