i.e. currently we use a type OldType
from an npm package @old-package
in our code base.
We want to replace it with our own type NewType
, which can be imported via @new-package
.
import {
AnyImport,
OldType,
AnotherImport
} from '@old-package';
should be updated to:
import {
AnyImport,
AnotherImport
} from '@old-package';
import { NewType } from '@new-package';
How can we do this refactoring in IntelliJ, so that the import statements are correctly updated?
Notes:
Since this is a on-off operation it's also okay, if this can be done in another IDE or via a command-line tool, etc.
Structural searching for imports is not supported/implemented at this time (related feature request: IDEA-285199). You can try some solutions available on the web, see https://www.npmjs.com/package/refactor-imports?activeTab=readme, for example