Switch to getApparentType

This commit is contained in:
Ron Buckton 2016-12-22 15:21:43 -08:00
parent decc7c220e
commit d0b7d4a93f

View File

@ -16281,18 +16281,10 @@ namespace ts {
}
}
function isTypeOrConstraintAnyOrNever(type: Type) {
while (type.flags & TypeFlags.TypeVariable) {
const constraint = getConstraintOfTypeVariable(<TypeVariable>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;