Accessing all children and subchildren MeshRender Component

I’m trying to set all childrens MeshRenderer to false…what I am i doing wrong?

public static var child : Transform[] = null;

var g = new Gun();

g.weapon = Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);

child = g.weapon.GetComponentsInChildren(typeof(Transform)) as Transform[];

for(var i : Transform in child){

    Debug.Log("children : " + i.gameObject.name);

    if(i.gameObject.GetComponent(MeshRenderer))
        i.gameObject.GetComponent(MeshRenderer).enabled = false; 

}

I would try something like this:

var allChildren = g.weapon.GetComponentsInChildren(Transform);
for (var child : Transform in allChildren) {
    if(child.gameObject.GetComponent(MeshRenderer)){
       child.gameObject.GetComponent(MeshRenderer).enabled = false;
    }    
}

Greetz, Ky.