typescript - Union type as key in interface? - Stack Overflow

PHOTO EMBED

Thu Mar 31 2022 08:56:55 GMT+0000 (Coordinated Universal Time)

Saved by @avivdaniel #javascript

enum possibleTypes { 'foo', 'bar' };
type Types {
    [key in keyof typeof possibleTypes]: boolean
}
content_copyCOPY

https://stackoverflow.com/questions/55023610/union-type-as-key-in-interface