//// [genericCloneReturnTypes2.ts] class MyList { public size: number; public data: T[]; constructor(n: number) { this.size = n; this.data = new Array(this.size); } public clone() { return new MyList(this.size); } } var a: MyList; var b: MyList = a.clone(); // ok var c: MyList = a.clone(); // bug was there was an error on this line var d: MyList = a.clone(); // error //// [genericCloneReturnTypes2.js] var MyList = (function () { function MyList(n) { this.size = n; this.data = new Array(this.size); } MyList.prototype.clone = function () { return new MyList(this.size); }; return MyList; })(); var a; var b = a.clone(); // ok var c = a.clone(); // bug was there was an error on this line var d = a.clone(); // error