feat(49358): use filename based on exported name (#49875)

This commit is contained in:
Oleksandr T authored and GitHub committed 2022-07-27 15:41:31 -07:00
1 parent 5b0eea48e9
commit 94bb950008
2 files changed
+42 -3

No files matched your search

+3 -3
View File
@@ -62,7 +62,7 @@ namespace ts.refactor {
const currentDirectory = getDirectoryPath(oldFile.fileName);
const extension = extensionFromPath(oldFile.fileName);
const newModuleName = makeUniqueModuleName(getNewModuleName(usage.movedSymbols), extension, currentDirectory, host);
const newModuleName = makeUniqueModuleName(getNewModuleName(usage.oldFileImportsFromNewFile, usage.movedSymbols), extension, currentDirectory, host);
const newFileNameWithExtension = newModuleName + extension;
// If previous file was global, this is easy.
@@ -478,8 +478,8 @@ namespace ts.refactor {
}
}
function getNewModuleName(movedSymbols: ReadonlySymbolSet): string {
return movedSymbols.forEachEntry(symbolNameNoDefault) || "newFile";
function getNewModuleName(importsFromNewFile: ReadonlySymbolSet, movedSymbols: ReadonlySymbolSet): string {
return importsFromNewFile.forEachEntry(symbolNameNoDefault) || movedSymbols.forEachEntry(symbolNameNoDefault) || "newFile";
}
interface UsageInfo {