I have defined a string-based enum. What is the idiomatic way to obtain type safe enum objects out of untyped strings?
E.g. what should I do in the following:
enum Car {
BMW = 'bmw',
AUDI = 'audi'
}
const car = 'bmw';
const typedCar: Car = // ??
The suggested way of doing a:
const typedCar: Car = Car[car];
(as suggested e.g. in this answer) does not work for String Enums AFAICT.