pragma strict convert object error

I get the following error below for `#pragma strict` - "Cannot convert 'Object' to 'UnityEngine.Transform'." How do you correctly typecast this?

o is an GameObject - defined in the function argument

function fred(o: GameObject){
  for(var child : Transform in o.transform){
    child.renderer.material = m;
  }
}   

You need to tell the compiler what o is. I assume you just have

var o;

somewhere.

You also don't need to make the transform a transform (with as). It already is one. If o can be a transform, then you can do this:

for (var child : Transform in o) child.renderer.material = m;

Otherwise, this:

for (var child : Transform in o.transform) child.renderer.material = m;

I wish I could say why that doesn't work under strict (perhaps someone more knowledgeable will come along with that answer), however this will get your code working...

for(var childObj : Object in o.transform){
    var child : Transform = childObj as Transform;
    child.renderer.material = m;
}