I have an enum:
enum Vehicles {
CAR = 1,
BOAT = 2,
AIRPLANE = 3
}
and an array that contains a subset of that enum:
const vehiclesThatFly: VehiclesThatFly = [Vehicles.AIRPLANE]
How can I make a Typescript type, VehiclesThatFly, that will warn me when a new enum member is added to the enum so that I am forced to either 1) add that new member to my vehiclesThatFly array or 2. explicitly exclude it in the VehiclesThatFly type? In other words, if a new enum member is added, I do not want to have to remember to add it to vehiclesThatFly, I want TS to tell me that enum hasn't been handled.
I am imagining the VehiclesThatFly type would look something like this pseudocode: Exclude<(Vehicles enum values), Vehicles.CAR | Vehicles.BOAT>.
Is it possible to create a type like VehiclesThatFly or is there a better way to achieve my goal of having Typescript force me to explicitly handle new enum members?