Problems with EditorGUI.ObjectField : error CS0266

Here is the snippet from the script that i have written. There is an error in the line testShader = EditorGUI.ObjectField (rect,“Calculate:”, testShader, (typeof (Shader)));

The error says “Assets/Editor/ShaderManager.cs(94,17): error CS0266: Cannot implicitly convert type UnityEngine.Object' to UnityEngine.Shader’. An explicit conversion exists (are you missing a cast?)”

I have tried a lot of stuff to resolve but I failed to resolve it. So any help would be highly appreciated.

Shader testShader= new Shader ();

Rect rect = EditorGUILayout.GetControlRect ();
GUIContent cont = new GUIContent ("Select a shader");

rect = EditorGUI.PrefixLabel (rect, cont);
testShader  = EditorGUI.ObjectField (rect,"Calculate:", testShader, (typeof (Shader)));
   
EditorGUI.BeginDisabledGroup (!testShader);
   
if(GUI.Button (EditorGUILayout.GetControlRect (), "Calculate!"))
        Calculate ();
    EditorGUI.EndDisabledGroup ();

ObjectField returns type Object:

and you’re trying to assign it to variable of type Shader so like the error says you need to explicitly tell compiler to cast what ObjectField method returns to Shader type:

testShader  = (Shader) EditorGUI.ObjectField (rect,"Calculate:", testShader, (typeof (Shader)));