Error:

The website encountered an unexpected error. Please try again later. TypeError: Argument passed to Drupal{module name}\Theme{class name}::__construct() must implement interface Drupal\path_alias\AliasManagerInterface, instance of Drupal\Core\Path\AliasManager

Getting error in the construct method, please suggest a solution to rectify the error.

Try to modify the "AliasManagerInterface" as "use Drupal\Core\Path\AliasManagerInterface" deprecated and we are now using "use Drupal\path_alias\AliasManagerInterface" but actually getting error inside construct method as mentioned below.

code:

 use Drupal\path_alias\AliasManagerInterface;



  /**
   * Protected pathAlias variable.
   *
   * @var Drupal\path_alias\AliasManagerInterface
   */
  protected $pathAlias;


  public function __construct(AliasManagerInterface $pathAlias) {
    
    $this->pathAlias = $pathAlias;

  }