Files
80fc33a72a Improve super.x output (#16374)
* clean

* improve

* tests

* fix lint

* old helpers

* add fail test

* fix

* Update packages/babel-helpers/src/helpers/superPropGet.ts

Co-authored-by: Nicolò Ribaudo <[email protected]>

* review

* fix lint

* minVersion

---------

Co-authored-by: Nicolò Ribaudo <[email protected]>
2024-07-23 11:37:07 +08:00

36 lines
820 B
JavaScript

"use strict";
let Base = /*#__PURE__*/function () {
function Base() {
babelHelpers.classCallCheck(this, Base);
}
return babelHelpers.createClass(Base, [{
key: "test",
get: function () {
expect(this).toBe(obj);
return 1;
}
}]);
}();
let Obj = /*#__PURE__*/function (_Base) {
function Obj() {
babelHelpers.classCallCheck(this, Obj);
return babelHelpers.callSuper(this, Obj, arguments);
}
babelHelpers.inherits(Obj, _Base);
return babelHelpers.createClass(Obj, [{
key: "get",
value: function get() {
return babelHelpers.superPropGet(Obj, "test", this, 1);
}
}]);
}(Base);
Object.defineProperty(Obj.prototype, 'test', {
value: 2,
writable: true,
configurable: true
});
const obj = new Obj();
expect(obj.test).toBe(2);
expect(obj.get()).toBe(1);