2015-02-03 00:15:54 +01:00
|
|
|
//// [staticPropertyNotInClassType.ts]
|
|
|
|
module NonGeneric {
|
|
|
|
class C {
|
|
|
|
fn() { return this; }
|
|
|
|
static get x() { return 1; }
|
|
|
|
static set x(v) { }
|
|
|
|
constructor(public a: number, private b: number) { }
|
|
|
|
static foo: string; // not reflected in class type
|
|
|
|
}
|
|
|
|
|
|
|
|
module C {
|
|
|
|
export var bar = ''; // not reflected in class type
|
|
|
|
}
|
|
|
|
|
|
|
|
var c = new C(1, 2);
|
|
|
|
var r = c.fn();
|
|
|
|
var r4 = c.foo; // error
|
|
|
|
var r5 = c.bar; // error
|
|
|
|
var r6 = c.x; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
module Generic {
|
|
|
|
class C<T, U> {
|
|
|
|
fn() { return this; }
|
|
|
|
static get x() { return 1; }
|
|
|
|
static set x(v) { }
|
|
|
|
constructor(public a: T, private b: U) { }
|
|
|
|
static foo: T; // not reflected in class type
|
|
|
|
}
|
|
|
|
|
|
|
|
module C {
|
|
|
|
export var bar = ''; // not reflected in class type
|
|
|
|
}
|
|
|
|
|
|
|
|
var c = new C(1, '');
|
|
|
|
var r = c.fn();
|
|
|
|
var r4 = c.foo; // error
|
|
|
|
var r5 = c.bar; // error
|
|
|
|
var r6 = c.x; // error
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [staticPropertyNotInClassType.js]
|
|
|
|
var NonGeneric;
|
|
|
|
(function (NonGeneric) {
|
|
|
|
var C = (function () {
|
|
|
|
function C(a, b) {
|
|
|
|
this.a = a;
|
|
|
|
this.b = b;
|
|
|
|
}
|
2015-02-07 05:03:24 +01:00
|
|
|
C.prototype.fn = function () { return this; };
|
2015-02-03 00:15:54 +01:00
|
|
|
Object.defineProperty(C, "x", {
|
2015-02-07 05:03:24 +01:00
|
|
|
get: function () { return 1; },
|
2015-02-07 03:45:09 +01:00
|
|
|
set: function (v) { },
|
2015-02-03 00:15:54 +01:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var C;
|
|
|
|
(function (C) {
|
|
|
|
C.bar = ''; // not reflected in class type
|
|
|
|
})(C || (C = {}));
|
|
|
|
var c = new C(1, 2);
|
|
|
|
var r = c.fn();
|
|
|
|
var r4 = c.foo; // error
|
|
|
|
var r5 = c.bar; // error
|
|
|
|
var r6 = c.x; // error
|
|
|
|
})(NonGeneric || (NonGeneric = {}));
|
|
|
|
var Generic;
|
|
|
|
(function (Generic) {
|
|
|
|
var C = (function () {
|
|
|
|
function C(a, b) {
|
|
|
|
this.a = a;
|
|
|
|
this.b = b;
|
|
|
|
}
|
2015-02-07 05:03:24 +01:00
|
|
|
C.prototype.fn = function () { return this; };
|
2015-02-03 00:15:54 +01:00
|
|
|
Object.defineProperty(C, "x", {
|
2015-02-07 05:03:24 +01:00
|
|
|
get: function () { return 1; },
|
2015-02-07 03:45:09 +01:00
|
|
|
set: function (v) { },
|
2015-02-03 00:15:54 +01:00
|
|
|
enumerable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var C;
|
|
|
|
(function (C) {
|
|
|
|
C.bar = ''; // not reflected in class type
|
|
|
|
})(C || (C = {}));
|
|
|
|
var c = new C(1, '');
|
|
|
|
var r = c.fn();
|
|
|
|
var r4 = c.foo; // error
|
|
|
|
var r5 = c.bar; // error
|
|
|
|
var r6 = c.x; // error
|
|
|
|
})(Generic || (Generic = {}));
|