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 56 57 58 59 60 61 62 63 64 65 66 67 68
|
//// [staticVisibility.ts]
class C1 {
p: any;
static s: any;
constructor() {
var v = 0;
s = 1; // should be error
C1.s = 1; // should be ok
b(); // should be error
C1.b(); // should be ok
}
static b() {
v = 1; // should be error
this.p = 0; // should be error
C1.s = 1; // should be ok
}
}
class C2 {
barback:string = "";
static get Bar() {return "bar";} // ok
static set Bar(bar:string) {barback = bar;} // not ok
}
//// [staticVisibility.js]
var C1 = /** @class */ (function () {
function C1() {
var v = 0;
s = 1; // should be error
C1.s = 1; // should be ok
b(); // should be error
C1.b(); // should be ok
}
C1.b = function () {
v = 1; // should be error
this.p = 0; // should be error
C1.s = 1; // should be ok
};
return C1;
}());
var C2 = /** @class */ (function () {
function C2() {
this.barback = "";
}
Object.defineProperty(C2, "Bar", {
get: function () { return "bar"; } // ok
,
set: function (bar) { barback = bar; } // not ok
,
enumerable: true,
configurable: true
});
return C2;
}());
|