Strip flow-only class props without needing transform-class-properties. (#3655)
This commit is contained in:
parent
043da1a26a
commit
2aaee8b8d4
@ -26,8 +26,17 @@ export default function ({ types: t }) {
|
|||||||
if (!path.node.value) path.remove();
|
if (!path.node.value) path.remove();
|
||||||
},
|
},
|
||||||
|
|
||||||
Class({ node }) {
|
Class(path) {
|
||||||
node.implements = null;
|
path.node.implements = null;
|
||||||
|
|
||||||
|
// We do this here instead of in a `ClassProperty` visitor because the class transform
|
||||||
|
// would transform the class before we reached the class property.
|
||||||
|
path.get("body.body").forEach((child) => {
|
||||||
|
if (child.isClassProperty()) {
|
||||||
|
child.node.typeAnnotation = null;
|
||||||
|
if (!child.node.value) child.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
Function({ node }) {
|
Function({ node }) {
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
class Test {
|
||||||
|
prop: string;
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
let Test = function Test() {
|
||||||
|
babelHelpers.classCallCheck(this, Test);
|
||||||
|
};
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"transform-flow-strip-types",
|
||||||
|
"transform-es2015-classes",
|
||||||
|
"external-helpers"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user