51 lines
757 B
TypeScript
51 lines
757 B
TypeScript
//// [accessorWithES5.ts]
|
|
|
|
class C {
|
|
get x() {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
class D {
|
|
set x(v) {
|
|
}
|
|
}
|
|
|
|
var x = {
|
|
get a() { return 1 }
|
|
}
|
|
|
|
var y = {
|
|
set b(v) { }
|
|
}
|
|
|
|
//// [accessorWithES5.js]
|
|
var C = (function () {
|
|
function C() {
|
|
}
|
|
Object.defineProperty(C.prototype, "x", {
|
|
get: function () {
|
|
return 1;
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
return C;
|
|
}());
|
|
var D = (function () {
|
|
function D() {
|
|
}
|
|
Object.defineProperty(D.prototype, "x", {
|
|
set: function (v) {
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
return D;
|
|
}());
|
|
var x = {
|
|
get a() { return 1; }
|
|
};
|
|
var y = {
|
|
set b(v) { }
|
|
};
|