feature: TSTypeOperator: keyof (#16799)
| Q | A |
|---|---|
| Fixed Issues? | Fixes https://github.com/babel/babel/issues/16799 |
| Patch: Bug Fix? | |
| Major: Breaking Change? | |
| Minor: New Feature? | |
| Tests Added + Pass? | Yes |
| Documentation PR Link | |
| Any Dependency Changes? | |
| License | MIT |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59636
Since a TSTypeOperator without operator is not valid, maybe we can not treat it as a new feature?
Since a
TSTypeOperatorwithoutoperatoris not valid, maybe we can not treat it as a new feature?
OK, will merge it as a bugfix once CI passes.
hi, I have a question about this change.
It seems to make the second argument of TSTypeOperator mandatory, which would be a breaking change for those relying on the previous behavior. Previously, this argument was not required. Could you confirm if this is intentional?
It was a bug, operator cannot be empty it produces invalid code.
Yeah the difference was that before we would let you create an invalid AST and then silently print some code that does not correspond to it. Now we prevent you from generating the invalid AST in the first place.
@coderaiser @nicolo-ribaudo
Thank you for the clarification.
I understand this is intended as a bug fix, but it seems to be a breaking change. Shouldn't we consider including it in a major release to align with semantic versioning?
Also, for existing babel plugins that used TSTypeOperator without the second argument, is the recommended path for them to update their own code? I'd like to understand the intended migration path for users.
Mh yeah I saw your code, and indeed it was not "generating invalid Babel output". I'll open a PR to make this parameter optional in Babel 7.