diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/input.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/input.js new file mode 100644 index 0000000000..970c1db08e --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/input.js @@ -0,0 +1,7 @@ +const sym = Symbol(); +const sym1 = Symbol(); + +class A { + [sym]: A.B; + [sym1]: Array; +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/options.json new file mode 100644 index 0000000000..0e9a8e684e --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + "flow" + ], + "plugins": [ + "proposal-class-properties" + ] +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/output.js new file mode 100644 index 0000000000..fd32a2ea96 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type-challenge/output.js @@ -0,0 +1,13 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +const sym = Symbol(); +const sym1 = Symbol(); + +class A { + constructor() { + _defineProperty(this, sym, void 0); + + _defineProperty(this, sym1, void 0); + } + +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/input.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/input.js new file mode 100644 index 0000000000..ccab984820 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/input.js @@ -0,0 +1,5 @@ +const sym = Symbol(); + +class A { + [sym]: A; +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/options.json new file mode 100644 index 0000000000..0e9a8e684e --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/options.json @@ -0,0 +1,8 @@ +{ + "presets": [ + "flow" + ], + "plugins": [ + "proposal-class-properties" + ] +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/output.js b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/output.js new file mode 100644 index 0000000000..bfd8df8eda --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-class-properties/recursive-class-property-type/output.js @@ -0,0 +1,10 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +const sym = Symbol(); + +class A { + constructor() { + _defineProperty(this, sym, void 0); + } + +} diff --git a/packages/babel-helper-replace-supers/src/index.js b/packages/babel-helper-replace-supers/src/index.js index d8da1f0409..e6d45b7464 100644 --- a/packages/babel-helper-replace-supers/src/index.js +++ b/packages/babel-helper-replace-supers/src/index.js @@ -40,6 +40,9 @@ function skipAllButComputedKey(path) { } export const environmentVisitor = { + TypeAnnotation(path) { + path.skip(); + }, Function(path) { // Methods will be handled by the Method visit if (path.isMethod()) return;