How to use function (T component)

I am using the following two functions after following the Unity Roguelike tutorial and I am trying to modify it so that the player can attack the enemies. The problem comes in because im unfamiliar with the function(T component) function and im unsure of how to call it.

The AttemptMove() function checks if the player collides with anything and if its a wall, then the second function, OnCantMove() is called. How can I check what the ‘hitComponent’ is that is being passed into the OnCantMove() function so that I can create if statements for different objects.

Thanks guys.

    protected virtual void AttemptMove<T> (int xDir, int yDir)
             where T: Component
         {
             RaycastHit2D hit; 
             bool canMove= Move (xDir, yDir, out hit);
             if (hit.transform == null)
                 return;
     
             T hitComponent = hit.transform.GetComponent<T> ();
     
             if (!canMove && hitComponent != null)
                 OnCantMove (hitComponent); 
         }
     
 and `
            protected override void OnCantMove<T>(T component)
        {
 
         Wall hitWall = component as Wall;
         hitWall.DamageWall (wallDamage);
         animator.SetTrigger ("PlayerChop");
 
       }`

protected void OnCantMove(T component)
{
Debug.Log(component.GetType());

        if(component is Transform)
        {

        }
    }

Should do the trick.