@@ -24518,7 +24518,7 @@ namespace ts {
24518
24518
resultType = numberType;
24519
24519
}
24520
24520
// At least one is assignable to bigint, so check that both are
24521
- else if (isTypeAssignableToKind (leftType, TypeFlags.BigIntLike) && isTypeAssignableToKind( rightType, TypeFlags.BigIntLike )) {
24521
+ else if (bothAreBigIntLike (leftType, rightType)) {
24522
24522
switch (operator) {
24523
24523
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
24524
24524
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
@@ -24528,7 +24528,7 @@ namespace ts {
24528
24528
}
24529
24529
// Exactly one of leftType/rightType is assignable to bigint
24530
24530
else {
24531
- reportOperatorError((awaitedLeft, awaitedRight) => isTypeAssignableToKind(awaitedLeft, TypeFlags.BigIntLike) && isTypeAssignableToKind(awaitedRight, TypeFlags.BigIntLike) );
24531
+ reportOperatorError(bothAreBigIntLike );
24532
24532
resultType = errorType;
24533
24533
}
24534
24534
if (leftOk && rightOk) {
@@ -24578,9 +24578,9 @@ namespace ts {
24578
24578
// might be missing an await without doing an exhaustive check that inserting
24579
24579
// await(s) will actually be a completely valid binary expression.
24580
24580
const closeEnoughKind = TypeFlags.NumberLike | TypeFlags.BigIntLike | TypeFlags.StringLike | TypeFlags.AnyOrUnknown;
24581
- reportOperatorError((awaitedLeft, awaitedRight ) =>
24582
- isTypeAssignableToKind(awaitedLeft , closeEnoughKind) &&
24583
- isTypeAssignableToKind(awaitedRight , closeEnoughKind));
24581
+ reportOperatorError((left, right ) =>
24582
+ isTypeAssignableToKind(left , closeEnoughKind) &&
24583
+ isTypeAssignableToKind(right , closeEnoughKind));
24584
24584
return anyType;
24585
24585
}
24586
24586
@@ -24648,6 +24648,10 @@ namespace ts {
24648
24648
return Debug.fail();
24649
24649
}
24650
24650
24651
+ function bothAreBigIntLike(left: Type, right: Type): boolean {
24652
+ return isTypeAssignableToKind(left, TypeFlags.BigIntLike) && isTypeAssignableToKind(right, TypeFlags.BigIntLike);
24653
+ }
24654
+
24651
24655
function checkAssignmentDeclaration(kind: AssignmentDeclarationKind, rightType: Type) {
24652
24656
if (kind === AssignmentDeclarationKind.ModuleExports) {
24653
24657
for (const prop of getPropertiesOfObjectType(rightType)) {
@@ -24760,7 +24764,7 @@ namespace ts {
24760
24764
if (!wouldWorkWithAwait && isRelated) {
24761
24765
[effectiveLeft, effectiveRight] = getBaseTypesIfUnrelated(leftType, rightType, isRelated);
24762
24766
}
24763
- let [leftStr, rightStr] = getTypeNamesForErrorDisplay(effectiveLeft, effectiveRight);
24767
+ const [leftStr, rightStr] = getTypeNamesForErrorDisplay(effectiveLeft, effectiveRight);
24764
24768
if (!tryGiveBetterPrimaryError(errNode, wouldWorkWithAwait, leftStr, rightStr)) {
24765
24769
errorAndMaybeSuggestAwait(
24766
24770
errNode,
0 commit comments