2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/propagationOfPromiseInitialization.ts ===
interface IPromise<T> {
>IPromise : IPromise<T>
>T : T
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>;
>then : <TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
>TResult : TResult
>successCallback : (promiseValue: T) => TResult
>promiseValue : T
>T : T
>TResult : TResult
>errorCallback : (reason: any) => TResult
>reason : any
>TResult : TResult
2014-08-19 04:56:03 +02:00
>IPromise : IPromise<T>
2014-08-15 23:33:16 +02:00
>TResult : TResult
}
var foo: IPromise<number>;
>foo : IPromise<number>
2014-08-19 04:56:03 +02:00
>IPromise : IPromise<T>
2014-08-15 23:33:16 +02:00
foo.then((x) => {
2014-08-22 03:39:46 +02:00
>foo.then((x) => { // x is inferred to be a number return "asdf";}).then((x) => { // x is inferred to be string x.length; return 123;}) : IPromise<number>
>foo.then((x) => { // x is inferred to be a number return "asdf";}).then : <TResult>(successCallback: (promiseValue: string) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
>foo.then((x) => { // x is inferred to be a number return "asdf";}) : IPromise<string>
2014-08-15 23:33:16 +02:00
>foo.then : <TResult>(successCallback: (promiseValue: number) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
>foo : IPromise<number>
>then : <TResult>(successCallback: (promiseValue: number) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
2014-08-22 03:39:46 +02:00
>(x) => { // x is inferred to be a number return "asdf";} : (x: number) => string
2014-08-15 23:33:16 +02:00
>x : number
// x is inferred to be a number
return "asdf";
}).then((x) => {
>then : <TResult>(successCallback: (promiseValue: string) => TResult, errorCallback?: (reason: any) => TResult) => IPromise<TResult>
2014-08-22 03:39:46 +02:00
>(x) => { // x is inferred to be string x.length; return 123;} : (x: string) => number
2014-08-15 23:33:16 +02:00
>x : string
// x is inferred to be string
x.length;
>x.length : number
>x : string
>length : number
return 123;
});