File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,23 @@ interface TokenMatcher {
13
13
data ?: any ;
14
14
}
15
15
16
+ /* ignore typing for compatibility so it will seem "impossible" but different version will yield different source */
17
+ const diffCandidates : Array < typeof jestDiff . diff > = [
18
+ // @ts -ignore
19
+ jestDiffDefault ?. diff ,
20
+ // @ts -ignore
21
+ jestDiffDefault ,
22
+ // @ts -ignore
23
+ jestDiff ?. diff ,
24
+ // @ts -ignore
25
+ jestDiff ,
26
+ ] ;
27
+
28
+ const isFunction = ( fn : unknown ) : boolean => typeof fn === "function" ;
29
+
16
30
/* istanbul ignore next: covered by compatibility tests but not a single pass */
17
- /* @ts -ignore typing for compatibility so it will seem "impossible" but different version will yield different source */
18
- const diff : typeof jestDiff . diff = jestDiffDefault ?? jestDiff ?. diff ?? jestDiff ;
31
+ /* @ts -ignore assume one of the candidate matches, there will be a reasonable error later on if not */
32
+ const diff : typeof jestDiff . diff = diffCandidates . find ( isFunction ) ;
19
33
20
34
declare global {
21
35
namespace jest {
You can’t perform that action at this time.
0 commit comments