-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix: convertFunctionToEs6Class cannot recognize x.prototype = {}
pattern
#35219
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: convertFunctionToEs6Class cannot recognize x.prototype = {}
pattern
#35219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! I think it looks good, but I don’t think we can merge it without some accompanying tests. (If we make changes here in the future, we need to know what this does and whether our new changes are breaking it. Uncovered code tends to get broken or deleted eventually.)
Also, I just noticed how old this PR is, and I’m sorry for the delay—I know it’s not super cool to leave this sitting for 5 months and then request changes. We’re finally making a real effort to get our PR backlog organized, so hopefully we’ll be faster to respond in the future. Thanks for understanding ❤️ |
cool, I'll add some test later |
08ffbd3
to
e478808
Compare
What about: function Bar(...args) {
// code
}
Bar.prototype = {
// Should be ignored, as classes already include this:
constructor: Bar,
// Should result in `someField` being added to the class as a field.
someField: 123,
}; |
The removal of |
@andrewbranch hi I need help. the tests passed on my machine but not on CI |
@Jack-Works unrelated to the failures, but can you move your test files out from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for iterating on the original code; this is much easier to read now 🌟
hi @andrewbranch when to merge? |
Thanks for the reminder, we were waiting until master reflected 4.0. |
Currently, TypeScript's fixer cannot recognize this pattern:
This PR add the ability to recognize this pattern.
Before
After