type Candy =
| { name: "Skittles"; type: "Regular" | "Tropical" }
| { name: "Black Licorice"; qty: number }
| { name: "Runts"; isBanana: boolean };
Is there anyway to construct a type that accepts a sum type of that nature and allows you to filter based on a property, in this case name, so only include Skittles and Runts?