2014-07-13 01:04:16 +02:00
|
|
|
//// [contextualTypingOfConditionalExpression2.ts]
|
|
|
|
class A {
|
|
|
|
foo: number;
|
|
|
|
}
|
|
|
|
class B extends A {
|
|
|
|
bar: number;
|
|
|
|
}
|
|
|
|
class C extends A {
|
|
|
|
baz: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { };
|
|
|
|
|
|
|
|
|
|
|
|
//// [contextualTypingOfConditionalExpression2.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 A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var B = (function (_super) {
|
|
|
|
__extends(B, _super);
|
|
|
|
function B() {
|
|
|
|
_super.apply(this, arguments);
|
|
|
|
}
|
|
|
|
return B;
|
|
|
|
})(A);
|
|
|
|
var C = (function (_super) {
|
|
|
|
__extends(C, _super);
|
|
|
|
function C() {
|
|
|
|
_super.apply(this, arguments);
|
|
|
|
}
|
|
|
|
return C;
|
|
|
|
})(A);
|
2015-02-07 03:45:09 +01:00
|
|
|
var x2 = true ? function (a) { return a.foo; } : function (b) { };
|