Skip to content

[moveToNewFile] Fix namespace import update bug, simplify, comment, and rename - #51797

Merged
Andrew Branch (andrewbranch) merged 1 commit into
microsoft:mainfrom
andrewbranch:bug/move-to-new-file
Dec 7, 2022
Merged

Andrew Branch (andrewbranch) merged 1 commit into
microsoft:mainfrom
andrewbranch:bug/move-to-new-file

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Follow-up from a bug I noticed when reviewing #51702

Co-piloted by Isabel Duan (@iisaduan)

changes.replaceNode(sourceFile, ref, factory.createIdentifier(newNamespaceName));
}
changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, newModuleName, newModuleSpecifier));
changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, preferredNewNamespaceName, newModuleSpecifier));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the bug fix—everything else was cleanup. newModuleName wasn’t guaranteed to be a valid identifier.

@andrewbranch
Andrew Branch (andrewbranch) merged commit dc3daa6 into microsoft:main Dec 7, 2022
@andrewbranch
Andrew Branch (andrewbranch) deleted the bug/move-to-new-file branch December 7, 2022 00:38
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants