Get component not working in visual studio code

So i was trying to make a c# script for a homing missile but visual studio code was not letting me use the GetComponent function.
like first when i got this error i tried to change the code but later i figured out that if i remove all the code relating rigidbody, its showing no error but if we see with it, unity is saying “All compiler errors have to be fixed before entering playmode”.

Here’s the code:-

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class missileScript : MonoBehaviour
{
    public Transform target;

    private Rigidbody rb;

    public float speed = 5f;
    public float turn;

    void Start() {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate(){
        rb.velocity = transform.forward * speed;
        var RocketTargetPosition = Quaternion.LookRotation(target.position - transform.position);
        rb.MoveRotation(Quaternion.RotateTowards(transform.position, RocketTargetPosition, turn));
    }
}

transform.position isnt a quaternion which is the error thats being thrown. Changing it to a rotation quaternion value fixes the error you are having.

   rb.MoveRotation(Quaternion.RotateTowards(transform.position, RocketTargetPosition, turn));

Change to this.

rb.MoveRotation(Quaternion.RotateTowards(transform.rotation, RocketTargetPosition, turn));