http://answers.unity3d.com/questions/39864/invalidcastexception-in-a-code-from-script-reference
It's a good question, but was already asked, so I voted to close this; I believe the answers ought to be collected in one place.
As for your edit, that works, but I consider the Array class obsolete, now that UnityScript supports generics. Also, your script requires the use of dynamic typing. It doesn't matter, because it's a small bit of code running once, but you should at least know how to do better. (Using #pragma strict at the top of your scripts will help you write efficient code.) A couple more general tip: there's no point in using gameObject because GetComponentsInChildren is also a method of Component. And there's no reason to define a temporary variable outside of a function, if its scope is only within the function.
So, your code, with a List instead of a Unity Array:
private var colliders : MeshCollider[];
function Awake () {
var colliderList = new List.<MeshCollider>();
for (var component in GetComponentsInChildren(MeshCollider))
colliderList.Add(component as MeshCollider);
colliders = colliderList.ToArray();
}
But this kind of thing is why Array.ConvertAll exists. I don't know if it's faster or slower, but I like the look of it better:
colliders = System.Array.ConvertAll(
GetComponentsInChildren(MeshCollider),
function (component) component as MeshCollider
);
Here are pages that might be helpful to you, if you don't know what that code means yet:
http://unity3d.com/support/documentation/Manual/MonoUpgradeDetails.html
Array.ConvertAll
The syntax for lambda expressions is different in C#, but this example is less verbose than the MSDN's.
Finally, if you want optimum performance, you probably should just not bother with a List or ConvertAll, and implement the conversion yourself:
var colliderComponents = GetComponentsInChildren(MeshCollider);
colliders = new MeshCollider[colliderComponents.Length];
for (var i = 0; i < colliders.Length; ++i)
colliders _= colliderComponents *as MeshCollider;*_
_*```*_
_*<p>I don't think that looks any better or worse than the List method.</p>*_
_*<p>But the best thing to do, would be to report the useless error that stops this ideal code from compiling:</p>*_
_*```*_
_*colliders = GetComponentsInChildren.<MeshCollider>();*_
_*```*_
_*<p>And man, I've written so much here, now, that this question probably shouldn't be closed anymore. :-P</p>*_