From d0b7d4a93f07bfcb17161eb2c2aecab178c42932 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 22 Dec 2016 15:21:43 -0800 Subject: [PATCH] Switch to getApparentType --- src/compiler/checker.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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;