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

39 lines
905 B
JavaScript

"use strict";
let Base = /*#__PURE__*/function () {
function Base() {
babelHelpers.classCallCheck(this, Base);
}
return babelHelpers.createClass(Base, [{
key: "test",
set: function (v) {
throw new Error("gobbledygook");
}
}]);
}();
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: "call",
value: function call() {
return babelHelpers.superPropGet(Obj, "test", this, 3)([]);
}
}, {
key: "test",
value: function test() {
throw new Error("gobbledygook");
}
}]);
}(Base);
const obj = new Obj();
expect(() => {
obj.call();
// Assert that this throws, but that it's not
// a gobbledygook error that is thrown
}).toThrow(TypeError);