interface IPromise { then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise; } var foo: IPromise; foo.then((x) => { // x is inferred to be a number return "asdf"; }).then((x) => { // x is inferred to be string x.length; return 123; });