diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index b3c62c2085c..52f3277574e 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -422,6 +422,9 @@ namespace ts.FindAllReferences.Core { return mergeReferences(program, moduleReferences, getReferencedSymbolsForSymbol(symbol, /*node*/ undefined, sourceFiles, sourceFilesSet, checker, cancellationToken, options)); } + /** + * Merges the references by sorting them (by file index in sourceFiles and their location in it) that point to same definition symbol + */ function mergeReferences(program: Program, ...referencesToMerge: (SymbolAndEntries[] | undefined)[]): SymbolAndEntries[] | undefined { let result: SymbolAndEntries[] | undefined; for (const references of referencesToMerge) { diff --git a/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts b/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts index 0964188f939..464dcef1548 100644 --- a/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts +++ b/tests/cases/fourslash/findAllReferencesUmdModuleAsGlobalConst.ts @@ -38,6 +38,7 @@ //// "files": ["/src/index.ts", "typings/global.d.ts"] ////} +// GH#29533 // TODO:: this should be var THREE: typeof import instead of module name as var but thats existing issue and repros with quickInfo too. verify.singleReferenceGroup(`module "/node_modules/@types/three/index" var "/node_modules/@types/three/index": typeof import("/node_modules/@types/three/index")`); \ No newline at end of file