45 lines
2.4 KiB
Text
45 lines
2.4 KiB
Text
=== tests/cases/compiler/propagationOfPromiseInitialization.ts ===
|
|
interface IPromise<T> {
|
|
>IPromise : Symbol(IPromise, Decl(propagationOfPromiseInitialization.ts, 0, 0))
|
|
>T : Symbol(T, Decl(propagationOfPromiseInitialization.ts, 0, 19))
|
|
|
|
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>;
|
|
>then : Symbol(then, Decl(propagationOfPromiseInitialization.ts, 0, 23))
|
|
>TResult : Symbol(TResult, Decl(propagationOfPromiseInitialization.ts, 1, 9))
|
|
>successCallback : Symbol(successCallback, Decl(propagationOfPromiseInitialization.ts, 1, 18))
|
|
>promiseValue : Symbol(promiseValue, Decl(propagationOfPromiseInitialization.ts, 1, 36))
|
|
>T : Symbol(T, Decl(propagationOfPromiseInitialization.ts, 0, 19))
|
|
>TResult : Symbol(TResult, Decl(propagationOfPromiseInitialization.ts, 1, 9))
|
|
>errorCallback : Symbol(errorCallback, Decl(propagationOfPromiseInitialization.ts, 1, 64))
|
|
>reason : Symbol(reason, Decl(propagationOfPromiseInitialization.ts, 1, 82))
|
|
>TResult : Symbol(TResult, Decl(propagationOfPromiseInitialization.ts, 1, 9))
|
|
>IPromise : Symbol(IPromise, Decl(propagationOfPromiseInitialization.ts, 0, 0))
|
|
>TResult : Symbol(TResult, Decl(propagationOfPromiseInitialization.ts, 1, 9))
|
|
}
|
|
|
|
var foo: IPromise<number>;
|
|
>foo : Symbol(foo, Decl(propagationOfPromiseInitialization.ts, 4, 3))
|
|
>IPromise : Symbol(IPromise, Decl(propagationOfPromiseInitialization.ts, 0, 0))
|
|
|
|
foo.then((x) => {
|
|
>foo.then((x) => { // x is inferred to be a number return "asdf";}).then : Symbol(IPromise.then, Decl(propagationOfPromiseInitialization.ts, 0, 23))
|
|
>foo.then : Symbol(IPromise.then, Decl(propagationOfPromiseInitialization.ts, 0, 23))
|
|
>foo : Symbol(foo, Decl(propagationOfPromiseInitialization.ts, 4, 3))
|
|
>then : Symbol(IPromise.then, Decl(propagationOfPromiseInitialization.ts, 0, 23))
|
|
>x : Symbol(x, Decl(propagationOfPromiseInitialization.ts, 5, 10))
|
|
|
|
// x is inferred to be a number
|
|
return "asdf";
|
|
}).then((x) => {
|
|
>then : Symbol(IPromise.then, Decl(propagationOfPromiseInitialization.ts, 0, 23))
|
|
>x : Symbol(x, Decl(propagationOfPromiseInitialization.ts, 8, 9))
|
|
|
|
// x is inferred to be string
|
|
x.length;
|
|
>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
|
>x : Symbol(x, Decl(propagationOfPromiseInitialization.ts, 8, 9))
|
|
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
|
|
|
return 123;
|
|
});
|
|
|