diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d0923be003b..dcbd842cee3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16281,18 +16281,10 @@ namespace ts { } } - function isTypeOrConstraintAnyOrNever(type: Type) { - while (type.flags & TypeFlags.TypeVariable) { - const constraint = getConstraintOfTypeVariable(type); - if (!constraint) break; - type = getWidenedType(constraint); - } - return (type.flags & (TypeFlags.Any | TypeFlags.Never)) !== 0; - } - function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type { type = getWidenedType(type); - if (!isTypeOrConstraintAnyOrNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + const apparentType = getApparentType(type); + if ((apparentType.flags & (TypeFlags.Any | TypeFlags.Never)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;