Ternary operator fails, but verbose comparison doesnt?

Trying to write neat & compact code Im confused as to why in UnityScript this fails with error BCE0022: Cannot convert 'Object' to UnityEngine.Vector2...

var useTouch : boolean = true;
position = useTouch ? Input.touches[0].position : Input.mousePosition;

...yet the following is fine. Are they not essentially the same?

var useTouch : boolean = true;
if( useTouch )
    position = Input.touches[index].position;
else
    position = Input.mousePosition;

Input.touches[o].position is a vector2 and Input.mousePosition is a vector3. You are using javascript which, for better or worse, allows you to not declare what type position is. in your second working example it is clear that one case position is a vector2 and in another case it is a vector3. In your failing example you are saying if this is true, position is a vector2, and if it false it is a vector3, but it happens at runtime. At compile time which is it? it cannot be both a vector2 and vector3 so it fails. Try explicitly casting the vector2 to a vector3 in your first example and that should work..like Vector3(Input.touches[0].position.x,Input.touches[0].position.y,0.0F)...or maybe even (Vector3)Input.touches[0].position would work, you'd have to try and see.