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 transform-typescript logic to remove definite fields #12149
Conversation
…owDeclareFields is enabled
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/29481/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 4d0782f:
|
@nicolo-ribaudo please, could you take a look when you have some time? |
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!
Do you want to open a PR to the |
@existentialism @JLHwung @nicolo-ribaudo I'm new to contributing, is there anything else I need to do to get this merged? And afterward, do you have a timeline in mind when we can release this change? |
We have a 2-:heavy_check_mark: policy. After another approval, we can merge this PR and release it in the first next version (7.11.8 or 7.12.0). |
@akphi thanks! |
@nicolo-ribaudo @existentialism Thanks! I was about the make the changes you suggest 😀 Not too familiar with the release cycle of babel myself, when do you have an estimate for when will this happen? |
Soon :) |
I made sure to separate the handling for 2 cases: fields defined with the keyword
declare
and fields defined using the definite assignment operator.For the latter, when the flag
allowDeclareFields
is true (can be treated equivalent to TypescriptuseDefineForClassFields = true
) we will not remove the field.Also, since I separate the handling, I adjust the error message thrown by each case slightly when the fields in these 2 cases are given values.
Also, I added a test for
allowDeclareFields = false
to ensure old behavior works fine@nicolo-ribaudo What you said about babel's
allowDeclareFields
is similar to Typescript'suseDefineForClassFields
is interesting. Should we update the doc fortransform-typescript
here?