Skip to content

Commit d0b7d4a

Browse files
committed
Switch to getApparentType
1 parent decc7c2 commit d0b7d4a

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16281,18 +16281,10 @@ namespace ts {
1628116281
}
1628216282
}
1628316283

16284-
function isTypeOrConstraintAnyOrNever(type: Type) {
16285-
while (type.flags & TypeFlags.TypeVariable) {
16286-
const constraint = getConstraintOfTypeVariable(<TypeVariable>type);
16287-
if (!constraint) break;
16288-
type = getWidenedType(constraint);
16289-
}
16290-
return (type.flags & (TypeFlags.Any | TypeFlags.Never)) !== 0;
16291-
}
16292-
1629316284
function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type {
1629416285
type = getWidenedType(type);
16295-
if (!isTypeOrConstraintAnyOrNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) {
16286+
const apparentType = getApparentType(type);
16287+
if ((apparentType.flags & (TypeFlags.Any | TypeFlags.Never)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) {
1629616288
if (location) {
1629716289
if (!message) {
1629816290
message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member;

0 commit comments

Comments
 (0)