@@ -16493,7 +16493,6 @@ namespace ts {
1649316493 // }
1649416494 //
1649516495
16496- // TODO(rbuckton): Verify whether we need to call getApparentType. See checkNonThenableType in master
1649716496 const thenFunction = getTypeOfPropertyOfType(type, "then");
1649816497 const thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, SignatureKind.Call) : emptyArray;
1649916498 if (thenSignatures.length > 0) {
@@ -16600,7 +16599,7 @@ namespace ts {
1660016599 if (type.id === promisedType.id || indexOf(awaitedTypeStack, promisedType.id) >= 0) {
1660116600 // Verify that we don't have a bad actor in the form of a promise whose
1660216601 // promised type is the same as the promise type, or a mutually recursive
16603- // promise. If so, we returnundefined as we cannot guess the shape. If this
16602+ // promise. If so, we return undefined as we cannot guess the shape. If this
1660416603 // were the actual case in the JavaScript, this Promise would never resolve.
1660516604 //
1660616605 // An example of a bad actor with a singly-recursive promise type might
@@ -16664,15 +16663,14 @@ namespace ts {
1666416663 // of a runtime problem. If the user wants to return this value from an async
1666516664 // function, they would need to wrap it in some other value. If they want it to
1666616665 // be treated as a promise, they can cast to <any>.
16667- const widenedType = getWidenedType(type);
16668- if (isThenableType(widenedType)) {
16666+ if (isThenableType(type)) {
1666916667 if (errorNode) {
1667016668 error(errorNode, Diagnostics.Type_used_as_operand_to_await_or_the_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
1667116669 }
1667216670 return undefined;
1667316671 }
1667416672
16675- return typeAsAwaitable.awaitedTypeOfType = widenedType ;
16673+ return typeAsAwaitable.awaitedTypeOfType = type ;
1667616674 }
1667716675
1667816676 /**
0 commit comments