mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
organizeImports: Fix bug in reference-testing for renamed import (#22797)
This commit is contained in:
parent
54274a8a2a
commit
e0ca8a5f39
@ -197,6 +197,16 @@ export const Other = 1;
|
||||
assert.isEmpty(changes);
|
||||
});
|
||||
|
||||
testOrganizeImports("Renamed_used",
|
||||
{
|
||||
path: "/test.ts",
|
||||
content: `
|
||||
import { F1 as EffOne, F2 as EffTwo } from "lib";
|
||||
EffOne();
|
||||
`,
|
||||
},
|
||||
libFile);
|
||||
|
||||
testOrganizeImports("Simple",
|
||||
{
|
||||
path: "/test.ts",
|
||||
|
||||
@ -98,7 +98,7 @@ namespace ts.OrganizeImports {
|
||||
}
|
||||
else {
|
||||
// List of named imports
|
||||
const newElements = namedBindings.elements.filter(e => isDeclarationUsed(e.propertyName || e.name));
|
||||
const newElements = namedBindings.elements.filter(e => isDeclarationUsed(e.name));
|
||||
if (newElements.length < namedBindings.elements.length) {
|
||||
namedBindings = newElements.length
|
||||
? updateNamedImports(namedBindings, newElements)
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
// ==ORIGINAL==
|
||||
|
||||
import { F1 as EffOne, F2 as EffTwo } from "lib";
|
||||
EffOne();
|
||||
|
||||
// ==ORGANIZED==
|
||||
|
||||
import { F1 as EffOne } from "lib";
|
||||
EffOne();
|
||||
Loading…
x
Reference in New Issue
Block a user