Cannot implicitly convert type void to UnityEngine.Quaternion -- Working on a game where game manager detects spawn points, and lets user press buttons to rotate camera to the direction of the spawnpoint directions

Cannot implicitly convert type void to UnityEngine.Quaternion

Working on a game where game manager detects spawn points, and lets user press buttons to rotate camera to the direction of the spawnpoint directions

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

public class switchCam : MonoBehaviour
{
    GameObject targetEnemy;
    [HideInInspector]
    public List<spawnpoint> spawnpoints;

    public Transform[] spawnerDirections; // Array of spawner direction transforms
    public Button[] rotationButtons;      // Array of UI buttons for rotation

    private bool isRotating = false;
    private Quaternion targetRotation;

    private void Start()
    {
        // Disable all rotation buttons initially
        foreach (var button in rotationButtons)
        {
            button.interactable = true;
        }
    }

    private void Update()
    {
        if (isRotating)
        {
            // Smoothly rotate the camera towards the target rotation
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime);

            // Check if the camera rotation is close enough to the target rotation
            if (Quaternion.Angle(transform.rotation, targetRotation) < 1.0f)
            {
                isRotating = false;
            }
        }
    }

    public void RotateCameraToDirection(int directionIndex)
    {
        if (directionIndex >= 0 && directionIndex < spawnerDirections.Length)
        {
            // Calculate the target rotation to face the selected direction
            Vector3 direction = spawnerDirections[directionIndex].position - transform.position;
            targetRotation = AssignTargetRotation();

			// Enable rotation flag to start rotating
			isRotating = true;
        }
    }

	void AssignTargetRotation()
	{
		//get the spawnpoint where the closest target was originally spawned and calculate the direction between the castle and the spawnpoint
		int closestEnemySpawnPoint = targetEnemy.GetComponent<Enemy>().spawnPoint;
		Vector3 targetPosition = spawnpoints[closestEnemySpawnPoint].spawnPoint.position;
		Vector3 direction = (targetPosition - transform.position).normalized;

		//calculate the target rotation
		Vector3 temporaryRotation = Quaternion.LookRotation(direction).eulerAngles;
		temporaryRotation = new Vector3(transform.rotation.x, temporaryRotation.y - 90, transform.rotation.z);
		targetRotation = Quaternion.Euler(temporaryRotation);
	}
}

The Error is in this line in the RotateCameraToDirection Function:
targetRotation = AssignTargetRotation();
You assign the return value of this function to targetRotation, but AssignTargetRotation() does not have any return type at all. Instead, you assign targetRotation in the function directly.
So, to fix this, instead of assigning the value, you can just call the function.