|
| 1 | +=== tests/cases/compiler/asyncFunctionContextuallyTypedReturns.ts === |
| 2 | +declare function f(cb: (v: boolean) => [0] | PromiseLike<[0]>): void; |
| 3 | +>f : Symbol(f, Decl(asyncFunctionContextuallyTypedReturns.ts, 0, 0)) |
| 4 | +>cb : Symbol(cb, Decl(asyncFunctionContextuallyTypedReturns.ts, 0, 19)) |
| 5 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 0, 24)) |
| 6 | +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) |
| 7 | + |
| 8 | +f(v => v ? [0] : Promise.reject()); |
| 9 | +>f : Symbol(f, Decl(asyncFunctionContextuallyTypedReturns.ts, 0, 0)) |
| 10 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 1, 2)) |
| 11 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 1, 2)) |
| 12 | +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 13 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 14 | +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 15 | + |
| 16 | +f(async v => v ? [0] : Promise.reject()); |
| 17 | +>f : Symbol(f, Decl(asyncFunctionContextuallyTypedReturns.ts, 0, 0)) |
| 18 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 2, 7)) |
| 19 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 2, 7)) |
| 20 | +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 21 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 22 | +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 23 | + |
| 24 | +declare function g(cb: (v: boolean) => "contextuallyTypable" | PromiseLike<"contextuallyTypable">): void; |
| 25 | +>g : Symbol(g, Decl(asyncFunctionContextuallyTypedReturns.ts, 2, 41)) |
| 26 | +>cb : Symbol(cb, Decl(asyncFunctionContextuallyTypedReturns.ts, 4, 19)) |
| 27 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 4, 24)) |
| 28 | +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) |
| 29 | + |
| 30 | +g(v => v ? "contextuallyTypable" : Promise.reject()); |
| 31 | +>g : Symbol(g, Decl(asyncFunctionContextuallyTypedReturns.ts, 2, 41)) |
| 32 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 5, 2)) |
| 33 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 5, 2)) |
| 34 | +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 35 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 36 | +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 37 | + |
| 38 | +g(async v => v ? "contextuallyTypable" : Promise.reject()); |
| 39 | +>g : Symbol(g, Decl(asyncFunctionContextuallyTypedReturns.ts, 2, 41)) |
| 40 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 6, 7)) |
| 41 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 6, 7)) |
| 42 | +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 43 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 44 | +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 45 | + |
| 46 | +type MyCallback = (thing: string) => void; |
| 47 | +>MyCallback : Symbol(MyCallback, Decl(asyncFunctionContextuallyTypedReturns.ts, 6, 59)) |
| 48 | +>thing : Symbol(thing, Decl(asyncFunctionContextuallyTypedReturns.ts, 8, 19)) |
| 49 | + |
| 50 | +declare function h(cb: (v: boolean) => MyCallback | PromiseLike<MyCallback>): void; |
| 51 | +>h : Symbol(h, Decl(asyncFunctionContextuallyTypedReturns.ts, 8, 42)) |
| 52 | +>cb : Symbol(cb, Decl(asyncFunctionContextuallyTypedReturns.ts, 9, 19)) |
| 53 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 9, 24)) |
| 54 | +>MyCallback : Symbol(MyCallback, Decl(asyncFunctionContextuallyTypedReturns.ts, 6, 59)) |
| 55 | +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) |
| 56 | +>MyCallback : Symbol(MyCallback, Decl(asyncFunctionContextuallyTypedReturns.ts, 6, 59)) |
| 57 | + |
| 58 | +h(v => v ? (abc) => { } : Promise.reject()); |
| 59 | +>h : Symbol(h, Decl(asyncFunctionContextuallyTypedReturns.ts, 8, 42)) |
| 60 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 10, 2)) |
| 61 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 10, 2)) |
| 62 | +>abc : Symbol(abc, Decl(asyncFunctionContextuallyTypedReturns.ts, 10, 12)) |
| 63 | +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 64 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 65 | +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 66 | + |
| 67 | +h(async v => v ? (def) => { } : Promise.reject()); |
| 68 | +>h : Symbol(h, Decl(asyncFunctionContextuallyTypedReturns.ts, 8, 42)) |
| 69 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 11, 7)) |
| 70 | +>v : Symbol(v, Decl(asyncFunctionContextuallyTypedReturns.ts, 11, 7)) |
| 71 | +>def : Symbol(def, Decl(asyncFunctionContextuallyTypedReturns.ts, 11, 18)) |
| 72 | +>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 73 | +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) |
| 74 | +>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --)) |
| 75 | + |
0 commit comments