TypeScript/tests/baselines/reference/classSideInheritance1.js
2015-05-01 10:49:54 -07:00

47 lines
1.1 KiB
TypeScript

//// [classSideInheritance1.ts]
class A {
static bar(): string {
return "";
}
foo(): number { return 1; }
}
class C2 extends A {}
var a: A;
var c: C2;
a.bar(); // static off an instance - should be an error
c.bar(); // static off an instance - should be an error
A.bar(); // valid
C2.bar(); // valid
//// [classSideInheritance1.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 A = (function () {
function A() {
}
A.bar = function () {
return "";
};
A.prototype.foo = function () { return 1; };
return A;
})();
var C2 = (function (_super) {
__extends(C2, _super);
function C2() {
_super.apply(this, arguments);
}
return C2;
})(A);
var a;
var c;
a.bar(); // static off an instance - should be an error
c.bar(); // static off an instance - should be an error
A.bar(); // valid
C2.bar(); // valid