fix56509: return type if tryCreateAwaitedType fails (#58547)

This commit is contained in:
Isabel Duan
2024-05-16 14:02:15 -07:00
committed by GitHub
parent 5c21b7fd93
commit 4da470da37
6 changed files with 302 additions and 4 deletions
+1 -4
View File
@@ -41889,10 +41889,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// - The base constraint of `T` is an object type with a callable `then` method.
if (isAwaitedTypeNeeded(type)) {
const awaitedType = tryCreateAwaitedType(type);
if (awaitedType) {
return awaitedType;
}
return tryCreateAwaitedType(type) ?? type;
}
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");