Is there a method to refine a string to match an enum key in TypeScript without needing to re-cast it?
enum SupportedShapes {
circle = 'circle',
triangle = 'triangle',
square = 'square',
}
declare const square: string;
if (square in SupportedShapes) { // Any way to make this check refine `square`?
SupportedShapes[square]; // Err. "square as SupportedShapes" works here, but trying to avoid that
}