//// [typeInferenceReturnTypeCallback.ts] interface IList { map(f: (t: A) => B): IList; } class Nil implements IList{ map(f: (t: C) => D): IList { return null; } } class Cons implements IList{ map(f: (t: T) => U): IList { return this.foldRight(new Nil(), (t, acc) => { return new Cons(); }); } foldRight(z: E, f: (t: T, acc: E) => E): E { return null; } } //// [typeInferenceReturnTypeCallback.js] var Nil = (function () { function Nil() { } Nil.prototype.map = function (f) { return null; }; return Nil; })(); var Cons = (function () { function Cons() { } Cons.prototype.map = function (f) { return this.foldRight(new Nil(), function (t, acc) { return new Cons(); }); }; Cons.prototype.foldRight = function (z, f) { return null; }; return Cons; })();