fix(50654): "Move to a new file" breaks the declaration of referenced variable - #50681
Merged
Nathan Shively-Sanders (sandersn) merged 2 commits intoOct 26, 2022
Merged
Conversation
Oleksandr Tarasiuk (a-tarasyuk)
force-pushed
the
fix/50654
branch
from
September 8, 2022 10:01
3bd3dee to
354b742
Compare
Kashif Ahmed (ProKashif)
approved these changes
Sep 9, 2022
Nathan Shively-Sanders (sandersn)
requested review from
Gabriela Araujo Britto (gabritto) and
Isabel Duan (iisaduan)
September 23, 2022 16:38
Member
There was a problem hiding this comment.
When testing changes locally, the test cases do not work in .ts files though the behavior for "move to a new file" should be the same.
Edit: tested with import = syntax in TS, in which the "move to new file" action does work with this fix, but the action does not work with require, which is less surprising because it's not supported by TS
Oleksandr Tarasiuk (a-tarasyuk)
requested review from
Isabel Duan (iisaduan)
and removed request for
Gabriela Araujo Britto (gabritto)
October 25, 2022 08:04
Isabel Duan (iisaduan)
approved these changes
Oct 25, 2022
Isabel Duan (iisaduan)
left a comment
Member
There was a problem hiding this comment.
Changes look good to me, though I'd like another pair of eyes on this Nathan Shively-Sanders (@sandersn)
Isabel Duan (iisaduan)
requested a review
from Nathan Shively-Sanders (sandersn)
October 25, 2022 18:32
Gabriela Araujo Britto (gabritto)
approved these changes
Oct 25, 2022
| const checker = program.getTypeChecker(); | ||
| const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective); | ||
| if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { | ||
| if (oldFile.externalModuleIndicator === undefined && oldFile.commonJsModuleIndicator === undefined && usage.oldImportsNeededByNewFile.size() === 0) { |
There was a problem hiding this comment.
just out of curiosity, is there any reason why the change from !oldFile.externalModuleIndicator to oldFile.externalModuleIndicator === undefined was necessary?
Nathan Shively-Sanders (sandersn)
approved these changes
Oct 26, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #50654