It looks like you’re looking for something we’ve called “generalized supertype constraints” in the past. There was a pitch thread on it several years ago. I don’t know if it’s been discussed more recently or not.
2 Likes