@@ -23713,9 +23713,9 @@ namespace ts {
2371323713 }
2371423714 }
2371523715
23716- function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean {
23716+ function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage, isAwaitValid = false ): boolean {
2371723717 if (!isTypeAssignableTo(type, numberOrBigIntType)) {
23718- const awaitedType = getAwaitedType (type);
23718+ const awaitedType = isAwaitValid && getAwaitedTypeOfPromise (type);
2371923719 errorAndMaybeSuggestAwait(
2372023720 operand,
2372123721 !!awaitedType && isTypeAssignableTo(awaitedType, numberOrBigIntType),
@@ -24327,8 +24327,8 @@ namespace ts {
2432724327 }
2432824328 else {
2432924329 // 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 );
2433224332 let resultType: Type;
2433324333 // If both are any or unknown, allow operation; assume it will resolve to number
2433424334 if ((isTypeAssignableToKind(leftType, TypeFlags.AnyOrUnknown) && isTypeAssignableToKind(rightType, TypeFlags.AnyOrUnknown)) ||
0 commit comments