Bug Report
Current Behavior
@babel/plugin-transform-flow-comments moves the generic type arguments of the left hand side of the extends keyword to its right side
class A extends B /*:: <X>*/ {}
Input Code
REPL link
Expected behavior/code
class A /*:: <X>*/ extends B {}
Environment
- Babel version(s): v7.5.5
- How you are using Babel: Online REPL
Possible Solution
return {
//...
visitor: {
//...
ClassDeclaration(path) {
if (path.parentPath.isFlow()) {
return;
}
const { node } = path;
if (node.typeParameters) {
const typeParameters = path.get("typeParameters");
const id = path.get("id");
id.addComment("trailing", generateComment(typeParameters, node));
typeParameters.remove();
}
},
//...
},
};