mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06:00
Switch to getApparentType
This commit is contained in:
parent
decc7c220e
commit
d0b7d4a93f
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user