mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 03:09:39 -06:00
[moveToFile] Fix symbols with empty declarations being treated as importable (#61084)
This commit is contained in:
parent
66e1b24831
commit
739d729ecc
@ -886,7 +886,7 @@ export function getUsageInfo(oldFile: SourceFile, toMove: readonly Statement[],
|
||||
const unusedImportsFromOldFile = new Set<Symbol>();
|
||||
for (const statement of toMove) {
|
||||
forEachReference(statement, checker, enclosingRange, (symbol, isValidTypeOnlyUseSite) => {
|
||||
if (!symbol.declarations) {
|
||||
if (!some(symbol.declarations)) {
|
||||
return;
|
||||
}
|
||||
if (existingTargetLocals.has(skipAlias(symbol, checker))) {
|
||||
|
||||
15
tests/cases/fourslash/moveToFile_undefined.ts
Normal file
15
tests/cases/fourslash/moveToFile_undefined.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @module: esnext
|
||||
// @moduleResolution: bundler
|
||||
|
||||
// @Filename: /orig.ts
|
||||
//// [|export const variable = undefined;|]
|
||||
|
||||
verify.moveToFile({
|
||||
newFileContents: {
|
||||
"/orig.ts": "",
|
||||
"/new.ts": "export const variable = undefined;\n"
|
||||
},
|
||||
interactiveRefactorArguments: { targetFile: "/new.ts" },
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user