41 lines
655 B
TypeScript
41 lines
655 B
TypeScript
//// [interfaceExtendingClass.ts]
|
|
class Foo {
|
|
x: string;
|
|
y() { }
|
|
get Z() {
|
|
return 1;
|
|
}
|
|
[x: string]: Object;
|
|
}
|
|
|
|
interface I extends Foo {
|
|
}
|
|
|
|
var i: I;
|
|
var r1 = i.x;
|
|
var r2 = i.y();
|
|
var r3 = i.Z;
|
|
|
|
var f: Foo = i;
|
|
i = f;
|
|
|
|
//// [interfaceExtendingClass.js]
|
|
var Foo = (function () {
|
|
function Foo() {
|
|
}
|
|
Foo.prototype.y = function () { };
|
|
Object.defineProperty(Foo.prototype, "Z", {
|
|
get: function () {
|
|
return 1;
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
return Foo;
|
|
}());
|
|
var i;
|
|
var r1 = i.x;
|
|
var r2 = i.y();
|
|
var r3 = i.Z;
|
|
var f = i;
|
|
i = f;
|