1
+ // @ts -ignore: this is private API. This import will work Ember 5.1+ since it
2
+ // "provides" this public API, but does not for earlier versions. As a result,
3
+ // this type will be `any`.
1
4
import { _backburner } from '@ember/runloop' ;
2
5
import { DebugInfo as BackburnerDebugInfo } from '@ember/runloop/-private/backburner' ;
3
6
import { DebugInfoHelper , debugInfoHelpers } from './debug-info-helpers' ;
@@ -109,7 +112,12 @@ export class TestDebugInfo implements DebugInfo {
109
112
. filter ( isNotNullable )
110
113
. reduce ( ( total , item ) => {
111
114
Object . values ( item ) . forEach ( ( queueItems ) => {
112
- total += queueItems ?. length ?? 0 ;
115
+ // SAFETY: this cast is required for versions of Ember which do
116
+ // not supply a correct definition of these types. It should
117
+ // also be compatible with the version where Ember *does* supply
118
+ // the types correctly.
119
+ total +=
120
+ ( queueItems as Array < unknown > | undefined ) ?. length ?? 0 ;
113
121
} ) ;
114
122
115
123
return total ;
@@ -119,7 +127,11 @@ export class TestDebugInfo implements DebugInfo {
119
127
. filter ( isNotNullable )
120
128
. reduce ( ( stacks , deferredActionQueues ) => {
121
129
Object . values ( deferredActionQueues ) . forEach ( ( queueItems ) => {
122
- queueItems ?. forEach (
130
+ // SAFETY: this cast is required for versions of Ember which do
131
+ // not supply a correct definition of these types. It should
132
+ // also be compatible with the version where Ember *does* supply
133
+ // the types correctly.
134
+ ( queueItems as Array < { stack : string } > | undefined ) ?. forEach (
123
135
( queueItem ) => queueItem . stack && stacks . push ( queueItem . stack )
124
136
) ;
125
137
} ) ;
0 commit comments