mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-08 22:29:37 -05:00
Switch to getApparentType
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user