48 lines
1 KiB
TypeScript
48 lines
1 KiB
TypeScript
//// [derivedClassFunctionOverridesBaseClassAccessor.ts]
|
|
class Base {
|
|
get x() {
|
|
return 1;
|
|
}
|
|
set x(v) {
|
|
}
|
|
}
|
|
|
|
// error
|
|
class Derived extends Base {
|
|
x() {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
//// [derivedClassFunctionOverridesBaseClassAccessor.js]
|
|
var __extends = (this && this.__extends) || function (d, b) {
|
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
function __() { this.constructor = d; }
|
|
__.prototype = b.prototype;
|
|
d.prototype = new __();
|
|
};
|
|
var Base = (function () {
|
|
function Base() {
|
|
}
|
|
Object.defineProperty(Base.prototype, "x", {
|
|
get: function () {
|
|
return 1;
|
|
},
|
|
set: function (v) {
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
return Base;
|
|
})();
|
|
// error
|
|
var Derived = (function (_super) {
|
|
__extends(Derived, _super);
|
|
function Derived() {
|
|
_super.apply(this, arguments);
|
|
}
|
|
Derived.prototype.x = function () {
|
|
return 1;
|
|
};
|
|
return Derived;
|
|
})(Base);
|