|
| 1 | +//// [tests/cases/compiler/awaitedTypeNoLib.ts] //// |
| 2 | + |
| 3 | +=== awaitedTypeNoLib.ts === |
| 4 | +type NotPromise<T> = T extends Thenable<unknown> |
| 5 | +>NotPromise : Symbol(NotPromise, Decl(awaitedTypeNoLib.ts, 0, 0)) |
| 6 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 0, 16)) |
| 7 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 0, 16)) |
| 8 | +>Thenable : Symbol(Thenable, Decl(awaitedTypeNoLib.ts, 6, 50)) |
| 9 | + |
| 10 | + ? T |
| 11 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 0, 16)) |
| 12 | + |
| 13 | + : T extends PromiseLike<unknown> |
| 14 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 0, 16)) |
| 15 | +>PromiseLike : Symbol(PromiseLike) |
| 16 | + |
| 17 | + ? never |
| 18 | + : T; |
| 19 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 0, 16)) |
| 20 | + |
| 21 | +type Receiver<T> = (value: NotPromise<T>) => void; |
| 22 | +>Receiver : Symbol(Receiver, Decl(awaitedTypeNoLib.ts, 4, 6)) |
| 23 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 6, 14)) |
| 24 | +>value : Symbol(value, Decl(awaitedTypeNoLib.ts, 6, 20)) |
| 25 | +>NotPromise : Symbol(NotPromise, Decl(awaitedTypeNoLib.ts, 0, 0)) |
| 26 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 6, 14)) |
| 27 | + |
| 28 | +class Thenable<T> { |
| 29 | +>Thenable : Symbol(Thenable, Decl(awaitedTypeNoLib.ts, 6, 50)) |
| 30 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 8, 15)) |
| 31 | + |
| 32 | + then(a: Receiver<T>) {} |
| 33 | +>then : Symbol(Thenable.then, Decl(awaitedTypeNoLib.ts, 8, 19)) |
| 34 | +>a : Symbol(a, Decl(awaitedTypeNoLib.ts, 9, 7)) |
| 35 | +>Receiver : Symbol(Receiver, Decl(awaitedTypeNoLib.ts, 4, 6)) |
| 36 | +>T : Symbol(T, Decl(awaitedTypeNoLib.ts, 8, 15)) |
| 37 | + |
| 38 | + private handleResolve<TResult>( |
| 39 | +>handleResolve : Symbol(Thenable.handleResolve, Decl(awaitedTypeNoLib.ts, 9, 25)) |
| 40 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 11, 24)) |
| 41 | + |
| 42 | + result: NotPromise<TResult> | Thenable<NotPromise<TResult>>, |
| 43 | +>result : Symbol(result, Decl(awaitedTypeNoLib.ts, 11, 33)) |
| 44 | +>NotPromise : Symbol(NotPromise, Decl(awaitedTypeNoLib.ts, 0, 0)) |
| 45 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 11, 24)) |
| 46 | +>Thenable : Symbol(Thenable, Decl(awaitedTypeNoLib.ts, 6, 50)) |
| 47 | +>NotPromise : Symbol(NotPromise, Decl(awaitedTypeNoLib.ts, 0, 0)) |
| 48 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 11, 24)) |
| 49 | + |
| 50 | + resolve: Receiver<TResult>, |
| 51 | +>resolve : Symbol(resolve, Decl(awaitedTypeNoLib.ts, 12, 64)) |
| 52 | +>Receiver : Symbol(Receiver, Decl(awaitedTypeNoLib.ts, 4, 6)) |
| 53 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 11, 24)) |
| 54 | + |
| 55 | + ) { |
| 56 | + if (result instanceof Thenable) { |
| 57 | +>result : Symbol(result, Decl(awaitedTypeNoLib.ts, 11, 33)) |
| 58 | +>Thenable : Symbol(Thenable, Decl(awaitedTypeNoLib.ts, 6, 50)) |
| 59 | + |
| 60 | + // #58547 This previously was a Debug Failure. False expression: type provided should not be a non-generic 'promise'-like. |
| 61 | + this.resolvePromise(result, resolve); |
| 62 | +>this.resolvePromise : Symbol(Thenable.resolvePromise, Decl(awaitedTypeNoLib.ts, 19, 3)) |
| 63 | +>this : Symbol(Thenable, Decl(awaitedTypeNoLib.ts, 6, 50)) |
| 64 | +>resolvePromise : Symbol(Thenable.resolvePromise, Decl(awaitedTypeNoLib.ts, 19, 3)) |
| 65 | +>result : Symbol(result, Decl(awaitedTypeNoLib.ts, 11, 33)) |
| 66 | +>resolve : Symbol(resolve, Decl(awaitedTypeNoLib.ts, 12, 64)) |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + private resolvePromise<TResult>( |
| 71 | +>resolvePromise : Symbol(Thenable.resolvePromise, Decl(awaitedTypeNoLib.ts, 19, 3)) |
| 72 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 21, 25)) |
| 73 | + |
| 74 | + result: Thenable<TResult>, |
| 75 | +>result : Symbol(result, Decl(awaitedTypeNoLib.ts, 21, 34)) |
| 76 | +>Thenable : Symbol(Thenable, Decl(awaitedTypeNoLib.ts, 6, 50)) |
| 77 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 21, 25)) |
| 78 | + |
| 79 | + resolve: Receiver<TResult>, |
| 80 | +>resolve : Symbol(resolve, Decl(awaitedTypeNoLib.ts, 22, 30)) |
| 81 | +>Receiver : Symbol(Receiver, Decl(awaitedTypeNoLib.ts, 4, 6)) |
| 82 | +>TResult : Symbol(TResult, Decl(awaitedTypeNoLib.ts, 21, 25)) |
| 83 | + |
| 84 | + ) {} |
| 85 | +} |
0 commit comments