error CS0118: `TreeHealth' is a `type' but a `variable' was expected

using UnityEngine;
using System.Collections;

public class MeleeSystem : MonoBehaviour
{

public int MinDamage = 25;
public int maxDamamge = 50;
public float weaponRange = 3.5f;

public Camera FPSCamera;

private void Update()
{
    Ray ray = FPSCamera.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2));
    RaycastHit hitInfo;
    if (Input.GetKeyDown(KeyCode.Mouse0))
    {
        if (Physics.Raycast(ray, out hitInfo, weaponRange))
        {
            if (hitInfo.collider.tag == "Tree")
            {
                TreeHealth = hitInfo.collider.GetComponentInParent<TreeHealth>();
                AttackTree();
            }
        }
    }
}

private void AttackTree()
{

}

}

TreeHealth = hitInfo.collider.GetComponentInParent();
is the equivalent of saying

int = 4;

You never game the name of a variable

 int a = 4

in your case, the solution would look like this:

TreeHealth treeHealth = hitInfo.collider.GetComponentInParent<TreeHealth>();