2014-07-13 01:04:16 +02:00
|
|
|
//// [returnInConstructor1.ts]
|
|
|
|
class A {
|
|
|
|
foo() { }
|
|
|
|
constructor() {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class B {
|
|
|
|
foo() { }
|
|
|
|
constructor() {
|
|
|
|
return 1; // error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class C {
|
|
|
|
foo() { }
|
|
|
|
constructor() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class D {
|
|
|
|
foo() { }
|
|
|
|
constructor() {
|
|
|
|
return "test"; // error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class E {
|
|
|
|
public foo: number;
|
|
|
|
constructor() {
|
|
|
|
return { foo: 1 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class F {
|
|
|
|
public foo: string;
|
|
|
|
constructor() {
|
|
|
|
return { foo: 1 }; //error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class G {
|
|
|
|
private test: number;
|
|
|
|
public test1() { }
|
|
|
|
foo() { }
|
|
|
|
constructor() {
|
|
|
|
this.test = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class H extends F {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
return new G(); //error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class I extends G {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
return new G();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//// [returnInConstructor1.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.prototype.foo = function () {
|
|
|
|
};
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var B = (function () {
|
|
|
|
function B() {
|
2014-08-16 00:16:17 +02:00
|
|
|
return 1; // error
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
B.prototype.foo = function () {
|
|
|
|
};
|
|
|
|
return B;
|
|
|
|
})();
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
C.prototype.foo = function () {
|
|
|
|
};
|
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var D = (function () {
|
|
|
|
function D() {
|
2014-08-16 00:16:17 +02:00
|
|
|
return "test"; // error
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
D.prototype.foo = function () {
|
|
|
|
};
|
|
|
|
return D;
|
|
|
|
})();
|
|
|
|
var E = (function () {
|
|
|
|
function E() {
|
|
|
|
return { foo: 1 };
|
|
|
|
}
|
|
|
|
return E;
|
|
|
|
})();
|
|
|
|
var F = (function () {
|
|
|
|
function F() {
|
2014-08-16 00:16:17 +02:00
|
|
|
return { foo: 1 }; //error
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
return F;
|
|
|
|
})();
|
|
|
|
var G = (function () {
|
|
|
|
function G() {
|
|
|
|
this.test = 2;
|
|
|
|
}
|
|
|
|
G.prototype.test1 = function () {
|
|
|
|
};
|
|
|
|
G.prototype.foo = function () {
|
|
|
|
};
|
|
|
|
return G;
|
|
|
|
})();
|
|
|
|
var H = (function (_super) {
|
|
|
|
__extends(H, _super);
|
|
|
|
function H() {
|
|
|
|
_super.call(this);
|
2014-08-16 00:16:17 +02:00
|
|
|
return new G(); //error
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
return H;
|
|
|
|
})(F);
|
|
|
|
var I = (function (_super) {
|
|
|
|
__extends(I, _super);
|
|
|
|
function I() {
|
|
|
|
_super.call(this);
|
|
|
|
return new G();
|
|
|
|
}
|
|
|
|
return I;
|
|
|
|
})(G);
|