@@ -652,10 +652,15 @@ namespace ts.FindAllReferences.Core {
652652 return undefined ;
653653 }
654654
655- // If the symbol has a parent, it's globally visible.
656- // Unless that parent is an external module, then we should only search in the module (and recurse on the export later).
657- // But if the parent is a module that has `export as namespace`, then the symbol *is* globally visible.
658- if ( parent && ! ( ( parent . flags & SymbolFlags . Module ) && isExternalModuleSymbol ( parent ) && ! parent . globalExports ) ) {
655+ /*
656+ If the symbol has a parent, it's globally visible unless:
657+ - It's a private property (handled above).
658+ - It's a type parameter.
659+ - The parent is an external module: then we should only search in the module (and recurse on the export later).
660+ - But if the parent has `export as namespace`, the symbol is globally visible through that namespace.
661+ */
662+ const exposedByParent = parent && ! ( symbol . flags & SymbolFlags . TypeParameter ) ;
663+ if ( exposedByParent && ! ( ( parent . flags & SymbolFlags . Module ) && isExternalModuleSymbol ( parent ) && ! parent . globalExports ) ) {
659664 return undefined ;
660665 }
661666
@@ -682,7 +687,7 @@ namespace ts.FindAllReferences.Core {
682687 // declare module "a" { export type T = number; }
683688 // declare module "b" { import { T } from "a"; export const x: T; }
684689 // So we must search the whole source file. (Because we will mark the source file as seen, we we won't return to it when searching for imports.)
685- return parent ? scope . getSourceFile ( ) : scope ;
690+ return exposedByParent ? scope . getSourceFile ( ) : scope ;
686691 }
687692
688693 function getPossibleSymbolReferencePositions ( sourceFile : SourceFile , symbolName : string , container : Node = sourceFile ) : number [ ] {
0 commit comments