Repository: facebook/react
File: compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts (TypeScript)

Code before:
      }
    }
    case 'AwaitExpression': {
      let expr = exprPath as NodePath<t.AwaitExpression>;
      return {
        kind: 'Await',
        value: lowerExpressionToTemporary(builder, expr.get('argument')),
        loc: exprLoc,
      };
    }
    case 'TypeCastExpression': {
      let expr = exprPath as NodePath<t.TypeCastExpression>;
      const typeAnnotation = expr.get('typeAnnotation').get('typeAnnotation');
      return {
        kind: 'TypeCastExpression',
        value: lowerExpressionToTemporary(builder, expr.get('expression')),
        typeAnnotation: typeAnnotation.node,
        type: lowerType(typeAnnotation.node),
        loc: exprLoc,
      };
    }
    case 'TSSatisfiesExpression':
    case 'TSAsExpression': {
      let expr = exprPath as NodePath<
        t.TSAsExpression | t.TSSatisfiesExpression
      >;
      const typeAnnotation = expr.get('typeAnnotation');
      return {
        kind: 'TypeCastExpression',
        value: lowerExpressionToTemporary(builder, expr.get('expression')),
        typeAnnotation: typeAnnotation.node,
        type: lowerType(typeAnnotation.node),
        loc: exprLoc,
      };
    }
    case 'UpdateExpression': {
      let expr = exprPath as NodePath<t.UpdateExpression>;
      const argument = expr.get('argument');
      if (argument.isMemberExpression()) {
        const binaryOperator = expr.node.operator === '++' ? '+' : '-';
        const leftExpr = argument as NodePath<t.MemberExpression>;
        const {object, property, value} = lowerMemberExpression(
          builder,
          leftExpr,
        );

        // Store the previous value to a temporary
        const previousValuePlace = lowerValueToTemporary(builder, value);
        // Store the new value to a temporary
        const updatedValue = lowerValueToTemporary(builder, {
          kind: 'BinaryExpression',

Review comment (suggestion):
Hmmmm the problem here is that we're not storing the `TSAsExpression | TSSatisfiesExpression` node themselves in our IR. Instead, we store the `typeAnnotation` (e.g. `number` part of `satisfies number`).

You'll want to make a change in `HIR.ts` -- you can add a typeAnnotationKind: 'as' | 'satisfies' property to the `TypeCastExpression` instruction.

Also I noticed that your test fixtures don't seem to be updated in the commits. Could you try `yarn snap --watch` and `yarn snap --update` locally so you get signal before submitting? Let me know if you have trouble with this (I know we hardcode linux paths so it may not be compatible)

Code after:
      }
    }
    case 'AwaitExpression': {
      let expr = exprPath as NodePath<t.AwaitExpression>;
      return {
        kind: 'Await',
        value: lowerExpressionToTemporary(builder, expr.get('argument')),
        loc: exprLoc,
      };
    }
    case 'TypeCastExpression': {
      let expr = exprPath as NodePath<t.TypeCastExpression>;
      const typeAnnotation = expr.get('typeAnnotation').get('typeAnnotation');
      return {
        kind: 'TypeCastExpression',
        value: lowerExpressionToTemporary(builder, expr.get('expression')),
        typeAnnotation: typeAnnotation.node,
        typeAnnotationKind: 'cast',
        type: lowerType(typeAnnotation.node),
        loc: exprLoc,
      };
    }
    case 'TSSatisfiesExpression': {
      let expr = exprPath as NodePath<t.TSSatisfiesExpression>;
      const typeAnnotation = expr.get('typeAnnotation');
      return {
        kind: 'TypeCastExpression',
        value: lowerExpressionToTemporary(builder, expr.get('expression')),
        typeAnnotation: typeAnnotation.node,
        typeAnnotationKind: 'satisfies',
        type: lowerType(typeAnnotation.node),
        loc: exprLoc,
      };
    }
    case 'TSAsExpression': {
      let expr = exprPath as NodePath<t.TSAsExpression>;
      const typeAnnotation = expr.get('typeAnnotation');
      return {
        kind: 'TypeCastExpression',
        value: lowerExpressionToTemporary(builder, expr.get('expression')),
        typeAnnotation: typeAnnotation.node,
        typeAnnotationKind: 'as',
        type: lowerType(typeAnnotation.node),
        loc: exprLoc,
      };
    }
    case 'UpdateExpression': {
      let expr = exprPath as NodePath<t.UpdateExpression>;
      const argument = expr.get('argument');
      if (argument.isMemberExpression()) {
        const binaryOperator = expr.node.operator === '++' ? '+' : '-';