93 lines
1.9 KiB
TypeScript
93 lines
1.9 KiB
TypeScript
//// [indexerConstraints2.ts]
|
|
class A { a: number; }
|
|
class B extends A { b: number; }
|
|
|
|
// Inheritance
|
|
class F {
|
|
[s: string]: B
|
|
}
|
|
class G extends F {
|
|
[n: number]: A
|
|
}
|
|
|
|
// Other way
|
|
class H {
|
|
[n: number]: A
|
|
}
|
|
class I extends H {
|
|
[s: string]: B
|
|
}
|
|
|
|
// With hidden indexer
|
|
class J {
|
|
[n: number]: {}
|
|
}
|
|
|
|
class K extends J {
|
|
[n: number]: A;
|
|
[s: string]: B;
|
|
}
|
|
|
|
//// [indexerConstraints2.js]
|
|
var __extends = (this && this.__extends) || (function () {
|
|
var extendStatics = Object.setPrototypeOf ||
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
return function (d, b) {
|
|
extendStatics(d, b);
|
|
function __() { this.constructor = d; }
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
};
|
|
})();
|
|
var A = (function () {
|
|
function A() {
|
|
}
|
|
return A;
|
|
}());
|
|
var B = (function (_super) {
|
|
__extends(B, _super);
|
|
function B() {
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
return B;
|
|
}(A));
|
|
// Inheritance
|
|
var F = (function () {
|
|
function F() {
|
|
}
|
|
return F;
|
|
}());
|
|
var G = (function (_super) {
|
|
__extends(G, _super);
|
|
function G() {
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
return G;
|
|
}(F));
|
|
// Other way
|
|
var H = (function () {
|
|
function H() {
|
|
}
|
|
return H;
|
|
}());
|
|
var I = (function (_super) {
|
|
__extends(I, _super);
|
|
function I() {
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
return I;
|
|
}(H));
|
|
// With hidden indexer
|
|
var J = (function () {
|
|
function J() {
|
|
}
|
|
return J;
|
|
}());
|
|
var K = (function (_super) {
|
|
__extends(K, _super);
|
|
function K() {
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
return K;
|
|
}(J));
|