@@ -186,8 +186,7 @@ namespace ts {
186
186
function key ( importedName : string , symbol : Symbol , moduleName : string , checker : TypeChecker ) {
187
187
const unquoted = stripQuotes ( moduleName ) ;
188
188
const moduleKey = isExternalModuleNameRelative ( unquoted ) ? "/" : unquoted ;
189
- const targetKey = symbol . flags & SymbolFlags . Alias ? createSymbolKey ( skipAlias ( symbol , checker ) ) : moduleName ;
190
- return `${ importedName } |${ targetKey } |${ moduleKey } ` ;
189
+ return `${ importedName } |${ createSymbolKey ( skipAlias ( symbol , checker ) , unquoted ) } |${ moduleKey } ` ;
191
190
}
192
191
193
192
function parseKey ( key : string ) {
@@ -197,15 +196,20 @@ namespace ts {
197
196
return { symbolName, ambientModuleName } ;
198
197
}
199
198
200
- function createSymbolKey ( symbol : Symbol ) {
199
+ function createSymbolKey ( symbol : Symbol , sourceModuleName : string ) {
201
200
let key = symbol . name ;
201
+ let seenModule = false ;
202
202
while ( symbol . parent ) {
203
+ seenModule = isExternalModuleSymbol ( symbol . parent ) ;
203
204
key += `,${ symbol . parent . name } ` ;
204
205
symbol = symbol . parent ;
205
206
}
206
- const decl = symbol . declarations ?. [ 0 ] ;
207
- const fileName = decl && getSourceFileOfNode ( decl ) . fileName ;
208
- return `${ key } ,${ fileName } ` ;
207
+ if ( ! seenModule ) {
208
+ const decl = symbol . declarations ?. [ 0 ] ;
209
+ const fileName = decl && getSourceFileOfNode ( decl ) . fileName ;
210
+ key += fileName || sourceModuleName ;
211
+ }
212
+ return key ;
209
213
}
210
214
211
215
function fileIsGlobalOnly ( file : SourceFile ) {
0 commit comments