• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//// [genericCallbacksAndClassHierarchy.ts]
2module M {
3    export interface I<T> {
4        subscribe(callback: (newValue: T) => void ): any;
5    }
6    export class C1<T> {
7        public value: I<T>;
8    }
9    export class A<T> {
10        public dummy: any;
11    }
12    export class B<T> extends C1<A<T>> { }
13    export class D<T> {
14        _subscribe(viewModel: B<T>): void {
15            var f = (newValue: A<T>) => { };
16
17            var v: I<A<T>> = viewModel.value;
18
19            // both of these should work
20            v.subscribe(f);
21            v.subscribe((newValue: A<T>) => { });
22        }
23    }
24}
25
26//// [genericCallbacksAndClassHierarchy.js]
27var __extends = (this && this.__extends) || (function () {
28    var extendStatics = function (d, b) {
29        extendStatics = Object.setPrototypeOf ||
30            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
32        return extendStatics(d, b);
33    };
34    return function (d, b) {
35        if (typeof b !== "function" && b !== null)
36            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37        extendStatics(d, b);
38        function __() { this.constructor = d; }
39        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40    };
41})();
42var M;
43(function (M) {
44    var C1 = /** @class */ (function () {
45        function C1() {
46        }
47        return C1;
48    }());
49    M.C1 = C1;
50    var A = /** @class */ (function () {
51        function A() {
52        }
53        return A;
54    }());
55    M.A = A;
56    var B = /** @class */ (function (_super) {
57        __extends(B, _super);
58        function B() {
59            return _super !== null && _super.apply(this, arguments) || this;
60        }
61        return B;
62    }(C1));
63    M.B = B;
64    var D = /** @class */ (function () {
65        function D() {
66        }
67        D.prototype._subscribe = function (viewModel) {
68            var f = function (newValue) { };
69            var v = viewModel.value;
70            // both of these should work
71            v.subscribe(f);
72            v.subscribe(function (newValue) { });
73        };
74        return D;
75    }());
76    M.D = D;
77})(M || (M = {}));
78