2014-07-13 01:04:16 +02:00
|
|
|
//// [genericCallbacksAndClassHierarchy.ts]
|
|
|
|
module M {
|
|
|
|
export interface I<T> {
|
|
|
|
subscribe(callback: (newValue: T) => void ): any;
|
|
|
|
}
|
|
|
|
export class C1<T> {
|
|
|
|
public value: I<T>;
|
|
|
|
}
|
|
|
|
export class A<T> {
|
|
|
|
public dummy: any;
|
|
|
|
}
|
|
|
|
export class B<T> extends C1<A<T>> { }
|
|
|
|
export class D<T> {
|
|
|
|
_subscribe(viewModel: B<T>): void {
|
|
|
|
var f = (newValue: A<T>) => { };
|
|
|
|
|
|
|
|
var v: I<A<T>> = viewModel.value;
|
|
|
|
|
|
|
|
// both of these should work
|
|
|
|
v.subscribe(f);
|
|
|
|
v.subscribe((newValue: A<T>) => { });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [genericCallbacksAndClassHierarchy.js]
|
|
|
|
var __extends = 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 M;
|
|
|
|
(function (M) {
|
|
|
|
var C1 = (function () {
|
|
|
|
function C1() {
|
|
|
|
}
|
|
|
|
return C1;
|
|
|
|
})();
|
|
|
|
M.C1 = C1;
|
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
M.A = A;
|
|
|
|
var B = (function (_super) {
|
|
|
|
__extends(B, _super);
|
|
|
|
function B() {
|
|
|
|
_super.apply(this, arguments);
|
|
|
|
}
|
|
|
|
return B;
|
|
|
|
})(C1);
|
|
|
|
M.B = B;
|
|
|
|
var D = (function () {
|
|
|
|
function D() {
|
|
|
|
}
|
|
|
|
D.prototype._subscribe = function (viewModel) {
|
2015-02-07 03:45:09 +01:00
|
|
|
var f = function (newValue) { };
|
2014-07-13 01:04:16 +02:00
|
|
|
var v = viewModel.value;
|
2014-08-16 00:49:09 +02:00
|
|
|
// both of these should work
|
2014-07-13 01:04:16 +02:00
|
|
|
v.subscribe(f);
|
2015-02-07 03:45:09 +01:00
|
|
|
v.subscribe(function (newValue) { });
|
2014-07-13 01:04:16 +02:00
|
|
|
};
|
|
|
|
return D;
|
|
|
|
})();
|
|
|
|
M.D = D;
|
|
|
|
})(M || (M = {}));
|