code: private Node tryFoldTypeof(Node originalTypeofNode) {
      checkArgument(originalTypeofNode.isTypeOf());
  
      Node argumentNode = originalTypeofNode.getFirstChild();
      if (argumentNode == null || !NodeUtil.isLiteralValue(argumentNode, true)) {
        return originalTypeofNode;
      }
  
      String typeNameString = null;
  
      switch (argumentNode.getToken()) {
        case FUNCTION:
          typeNameString = "function";
          break;
        case STRING:
          typeNameString = "string";
          break;
        case NUMBER:
          typeNameString = "number";
          break;
        case TRUE:
        case FALSE:
          typeNameString = "boolean";
          break;
        case NULL:
        case OBJECTLIT:
        case ARRAYLIT:
          typeNameString = "object";
          break;
        case VOID:
          typeNameString = "undefined";
          break;
        case NAME:
          // We assume here that programs don't change the value of the
          // keyword undefined to something other than the value undefined.
          if ("undefined".equals(argumentNode.getString())) {
            typeNameString = "undefined";
          }
          break;
        default:
          break;
      }
  
      if (typeNameString != null) {
        Node newNode = IR.string(typeNameString);
        reportChangeToEnclosingScope(originalTypeofNode);
        originalTypeofNode.replaceWith(newNode);
        markFunctionsDeleted(originalTypeofNode);
  
        return newNode;
      }
  
      return originalTypeofNode;
    }
docs: Folds 'typeof(foo)' if foo is a literal, e.g.
  typeof("bar") --> "string"
  typeof(6) --> "number"