@@ -1000,6 +1000,7 @@ namespace ts.Completions {
10001000 let completionKind = CompletionKind . None ;
10011001 let isNewIdentifierLocation = false ;
10021002 let keywordFilters = KeywordCompletionFilters . None ;
1003+ // This also gets mutated in nested-functions after the return
10031004 let symbols : Symbol [ ] = [ ] ;
10041005 const symbolToOriginInfoMap : SymbolOriginInfoMap = [ ] ;
10051006 const symbolToSortTextMap : SymbolSortTextMap = [ ] ;
@@ -1464,7 +1465,7 @@ namespace ts.Completions {
14641465 }
14651466
14661467 /**
1467- * Gathers symbols that can be imported from other files, deduplicating along the way. Symbols can be “ duplicates”
1468+ * Gathers symbols that can be imported from other files, de-duplicating along the way. Symbols can be " duplicates"
14681469 * if re-exported from another module, e.g. `export { foo } from "./a"`. That syntax creates a fresh symbol, but
14691470 * it’s just an alias to the first, and both have the same name, so we generally want to filter those aliases out,
14701471 * if and only if the the first can be imported (it may be excluded due to package.json filtering in
@@ -1548,7 +1549,7 @@ namespace ts.Completions {
15481549 // Don't add another completion for `export =` of a symbol that's already global.
15491550 // So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
15501551 if ( resolvedModuleSymbol !== moduleSymbol &&
1551- every ( resolvedModuleSymbol . declarations , d => ! ! d . getSourceFile ( ) . externalModuleIndicator ) ) {
1552+ every ( resolvedModuleSymbol . declarations , d => ! ! d . getSourceFile ( ) . externalModuleIndicator && ! findAncestor ( d , isGlobalScopeAugmentation ) ) ) {
15521553 pushSymbol ( resolvedModuleSymbol , moduleSymbol , /*skipFilter*/ true ) ;
15531554 }
15541555
0 commit comments