Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression no codefix for ts2657 #43635

Merged
merged 3 commits into from
May 20, 2021
Merged

Conversation

jeanp413
Copy link
Contributor

Fixes #43454

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Apr 11, 2021
@sandersn sandersn requested a review from andrewbranch May 19, 2021 00:27
@@ -6,7 +6,7 @@ namespace ts.codefix {
errorCodes,
getCodeActions: context => {
const { jsx } = context.program.getCompilerOptions();
if (jsx !== JsxEmit.React && jsx !== JsxEmit.ReactNative) {
if (!jsx || [JsxEmit.React, JsxEmit.ReactNative, JsxEmit.ReactJSX, JsxEmit.ReactJSXDev].indexOf(jsx) === -1) {
Copy link
Member

Choose a reason for hiding this comment

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

Why isn’t this allowed in JsxEmit.Preserve? The error still applies and the fix is still plausibly valid. Unless someone knows a good reason not to offer the fix, I would just do

Suggested change
if (!jsx || [JsxEmit.React, JsxEmit.ReactNative, JsxEmit.ReactJSX, JsxEmit.ReactJSXDev].indexOf(jsx) === -1) {
if (!jsx) {

And, by the way, even that should be unnecessary, since you should never get this error if you have undefined or JsxEmit.None anyway 🤔

Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

Thanks!

@andrewbranch andrewbranch merged commit ab81bf7 into microsoft:master May 20, 2021
@jeanp413 jeanp413 deleted the fix-43454 branch May 20, 2021 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Regression: Fix for error ts2657 no longer works
3 participants