@@ -23713,9 +23713,9 @@ namespace ts {
23713
23713
}
23714
23714
}
23715
23715
23716
- function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean {
23716
+ function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage, isAwaitValid = false ): boolean {
23717
23717
if (!isTypeAssignableTo(type, numberOrBigIntType)) {
23718
- const awaitedType = getAwaitedType (type);
23718
+ const awaitedType = isAwaitValid && getAwaitedTypeOfPromise (type);
23719
23719
errorAndMaybeSuggestAwait(
23720
23720
operand,
23721
23721
!!awaitedType && isTypeAssignableTo(awaitedType, numberOrBigIntType),
@@ -24327,8 +24327,8 @@ namespace ts {
24327
24327
}
24328
24328
else {
24329
24329
// otherwise just check each operand separately and report errors as normal
24330
- const leftOk = checkArithmeticOperandType(left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type);
24331
- const rightOk = checkArithmeticOperandType(right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type);
24330
+ const leftOk = checkArithmeticOperandType(left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, /*isAwaitValid*/ true );
24331
+ const rightOk = checkArithmeticOperandType(right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, /*isAwaitValid*/ true );
24332
24332
let resultType: Type;
24333
24333
// If both are any or unknown, allow operation; assume it will resolve to number
24334
24334
if ((isTypeAssignableToKind(leftType, TypeFlags.AnyOrUnknown) && isTypeAssignableToKind(rightType, TypeFlags.AnyOrUnknown)) ||
0 commit comments