Generate shortest rootDirs module specifier instead of first possible (#51244)

* Generate shortest rootDirs module specifier instead of first possible

* Simplify `min`
This commit is contained in:
Andrew Branch
2022-10-21 16:05:58 -07:00
committed by GitHub
parent bbb42f453d
commit ef69116c41
4 changed files with 37 additions and 11 deletions

View File

@@ -259,7 +259,7 @@ namespace ts {
}
function betterMatch(a: PatternMatch | undefined, b: PatternMatch | undefined): PatternMatch | undefined {
return min(a, b, compareMatches);
return min([a, b], compareMatches);
}
function compareMatches(a: PatternMatch | undefined, b: PatternMatch | undefined): Comparison {
return a === undefined ? Comparison.GreaterThan : b === undefined ? Comparison.LessThan