1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
//// [classPropertyAsPrivate.ts]
class C {
private x: string;
private get y() { return null; }
private set y(x) { }
private foo() { }
private static a: string;
private static get b() { return null; }
private static set b(x) { }
private static foo() { }
}
var c: C;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
//// [classPropertyAsPrivate.js]
var C = /** @class */ (function () {
function C() {
}
Object.defineProperty(C.prototype, "y", {
get: function () { return null; },
set: function (x) { },
enumerable: true,
configurable: true
});
C.prototype.foo = function () { };
Object.defineProperty(C, "b", {
get: function () { return null; },
set: function (x) { },
enumerable: true,
configurable: true
});
C.foo = function () { };
return C;
}());
var c;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo();
|