force customer to remove product from cart if not same type magento 2

if the same type of products is in the cart then force the customer to remove the products from the cart. Customers will not move on the checkout page till then cart having the same type of products.

Otherwise, an error will be displayed to remove products on the cart page