Refactoring Typescript in IntelliJ IDEA Ultimate 2021.2 seems less capable than I would expect
I did a Move refactoring on this module member in a Typescript file to another Typescript file:
export const goodsRelationship = models.relationshipNamed(fields.collectionModel, "Good")
models in the above line is imported as follows:
import {accessor, links, models, records} from "@docsndata/model-core2";
When I do the Move, a dialog box pops up to tell me:
"Selected constant goodsRelationship references unresolved import @docsndata/model-core2"
(Incidentally, the dialog box contains this message twice)
I click the Continue button and IntelliJ completes the Move, without the import.
Having been used to the immense power of Java + Kotlin refactoring all these years, I can't see why this refactor could not also apply the necessary import in the destination file...
Am I missing a setting in Intellij, or is this a planned feature yet to be implemented, or is it just harder than I appreciate in a Typescript codebase?
(Incase it matters, my project is a rushjs monorepo)
Please sign in to leave a comment.
Unresolved import must be a culprit; the import is normally added automatically when moving a member, but this only works for the stuff that can be resolved
Thanks Elena, it is good to know that it should work. The import is resolvable because my pre-refactoring source file is working. I think this might be that the rushjs monorepo is confusing the IDE. Its using local modules and some pnpm magic that I don't understand. Maybe I should create a mini repo on github to demonstrate?
Yes, a sample repo would be appreciated, thank you!