What I have are two enums
enum Fruit { Apples, Oranges };enum Vegetable { Garlic, Cucumber };
and a type
type Food = Fruit | Vegetable;
Now I want to make another type that is a function and takes a food as a parameter
type OnViewFood = (food: Food) => void;
But when I do
viewFruit: OnViewFood = (fruit: Fruit) => `This is ${fruit}`;
I get an error that Food is not assignable to Fruit.How do I achieve my goal?