Handle the case where the FAR results map is empty (#49254)

* Handle the case where the FAR results map is empty

Searching exactly one project does not imply the presence of exactly one references list.

Fixes #49217

* Use emptyArray

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
This commit is contained in:
Andrew Casey
2022-05-26 11:00:28 -07:00
committed by GitHub
parent 77ffb96b1a
commit 84974838c7
7 changed files with 40 additions and 2 deletions

View File

@@ -575,8 +575,7 @@ namespace ts.server {
// it easier for the caller to skip post-processing.
if (searchedProjects.size === 1) {
const it = resultsMap.values().next();
Debug.assert(!it.done);
return it.value;
return it.done ? emptyArray : it.value; // There may not be any results at all
}
return resultsMap;