babel-plugin-transform-class-properties: Ignore type annotations when looking for name collisions (#6082)
This commit is contained in:
@@ -12,6 +12,9 @@ export default function({ types: t }) {
|
||||
};
|
||||
|
||||
const referenceVisitor = {
|
||||
TypeAnnotation(path) {
|
||||
path.skip();
|
||||
},
|
||||
ReferencedIdentifier(path) {
|
||||
if (this.scope.hasOwnBinding(path.node.name)) {
|
||||
this.collision = true;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class C {
|
||||
// Output should not use `_initialiseProps`
|
||||
x: T;
|
||||
y = 0;
|
||||
constructor(T) {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
// Output should not use `_initialiseProps`
|
||||
constructor(T) {
|
||||
this.y = 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-typescript", "transform-class-properties"]
|
||||
}
|
||||
Reference in New Issue
Block a user