GetComponent(script).variable giving error on variable

I’m trying to modify a variable in another script. MonoDevelop highlights “targetPosition” in Script 1 in red.

Script 1:

var testS = projectileTransform.GetComponent (ProjectileMoveScript);
										testS.targetPosition = worldTargetPosition;

ProjectileMoveScript:

using UnityEngine;
using System.Collections;

public class ProjectileMoveScript : MonoBehaviour
{

		public float speed;
		public Vector3 targetPosition;

		void Update ()
		{
				transform.position = Vector2.MoveTowards (transform.position, targetPosition, Time.deltaTime * 2f);
		}
}

I think more of an issue accessing a C# script from JS - typing is probably necessary.
Try this:

var testS : ProjectileMoveScript;
testS = projectileTransform.GetComponent("ProjectileMoveScript");
testS.targetPosition = ...

I guess your code in script 1 is wrong. Are both scripts attached to your gameobject “projectileTransform”? If so, I would write it like this.
ProjectileMoveScript testS = projectileTransform.GetComponent();

IF they are not attached to the same gameobject:

 ProjectileMoveScript testS = GameObject.Find("projectileTransform").GetComponent<ProjectileMoveScript>();

Fixed it. I changed it to “projectileTransform.GetComponent().targetPosition = …”