Strongly Typed Javascript on iOS

My app just got riddled with errors when I went to build and run for iOS. I found out it was because of the lack of 'strongly typed javascript' via here. The errors all seem to be coming from wherever I use the 'GetComponent'. Here's how I'm doing it...

//declaring variable
var manager = GameObject.FindWithTag("TagName");
//calling function
manager.GetComponent(GameManager).someFunction;

How can I make this a strong type?

GetComponent returns Component, so it needs to be cast to the correct type. The easiest way is to use generics:

//declaring variable
var manager = GameObject.FindWithTag("TagName");
//calling function
manager.GetComponent.<GameManager>().someFunction;

You can also do it the "hard way":

manager.(GetComponent(GameManager) as GameManager).someFunction;

Add #pragma strict to the top of your file to make debugging easier and to force yourself to use strict typing.

Rule N1 is to never simply use a var anymore. Always declare it's variable, like so:

#pragma strict
var manager : GameObject = GameObject.FindWithTag("TagName");