2d rigibody error?

the game is 2d so why is error asking about rigidbody 2d its definitely a 2d game

error is Assets/Standard Assets/Scripts/General Scripts/DragRigidbody.js(30,18): BCE0019: ‘rigidbody2D’ is not a member of ‘UnityEngine.RaycastHit’. Did you mean ‘rigidbody’?

 if (!springJoint)
     {
         var go = new GameObject("Rigidbody2D dragger");
35.         var body : Rigidbody2D = go.AddComponent.<Rigidbody2D>() as Rigidbody2D;
         springJoint = go.AddComponent.<SpringJoint>();
         body.isKinematic = true;
     }
     
40.     springJoint.transform.position = hit.point;
     if (attachToCenterOfMass)
     {
         var anchor = transform.TransformDirection(hit.rigidbody2D.centerOfMass) + hit.rigidbody2D.transform.position;
         anchor = springJoint.transform.InverseTransformPoint(anchor);
45.         springJoint.anchor = anchor;
     }
     else
     {
         springJoint.anchor = Vector3.zero;
50.     }
     
     springJoint.spring = spring;
     springJoint.damper = damper;
     springJoint.maxDistance = distance;
55.     springJoint.connectedBody = hit.rigidbody2D;

Moving answer to duplicate question. i updated my unity 5. and now getting errors - Questions & Answers - Unity Discussions