Conversation
ghost
approved these changes
Feb 8, 2018
| const symbol = checker.getAliasedSymbol(umdSymbol); | ||
| if (symbol) { | ||
| return getCodeActionsForImport([{ moduleSymbol: symbol, importKind: getUmdImportKind(context.program.getCompilerOptions()) }], | ||
| convertToImportCodeFixContext(context, isIdentifier(token) ? token : undefined, umdSymbol.name)); |
There was a problem hiding this comment.
context.symbolToken is currently typed as Node | undefined and we check if it's an identifier when using it. So there is currently redundant checking. We could change its type to Identifier | undefined and remove the check at its use, or remove the check here.
| // This will always be an Identifier, since the diagnostics we fix only fail on identifiers. | ||
| const { sourceFile, span, program, cancellationToken } = context; | ||
| const checker = program.getTypeChecker(); | ||
| const symbolToken = getTokenAtPosition(sourceFile, span.start, /*includeJsDocComment*/ false); |
There was a problem hiding this comment.
It looks like this is the same in both UMD and non-UMD cases.
Contributor
Author
There was a problem hiding this comment.
yes. but i wanted to defer the call to convertContext untill i had the name.
ghost
approved these changes
Feb 8, 2018
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.
React fragments are one of the cases that were not handled correctly. we assume all umd imports are identifiers, and fail otherwise. this change:
checkJsxOpeningLikeElementOrOpeningFragmentlogic that reports the error in the first placeFixes #20805
Fixes #21767
Mitigates #21607