This question may seem similar to the one about converting strings to enums, but my situation is a bit more complicated. I have two different enums and another sum type over them:
enum InteractiveStep {
Pick = 'PICK',
Ban = 'BAN'
}
enum AutoStep {
RandomPick = 'RANDOM_PICK',
LastPick = 'LAST_PICK'
}
type ActionStep = InteractiveStep | AutoStep
How can I check whether an arbitrary string is contained in the ActionStep
type, and safely convert it?