Python: Type describing the string the literal union of enum names?

Submitted 3 years, 7 months ago
Ticket #126
Views 210
Language/Framework Python
Priority Medium
Status Closed

class Color(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3

Is there a type expression expression Foo such that:

Foo[Color] = Literal["RED", "GREEN", "BLUE"]

Submitted on Sep 10, 20
add a comment

1 Answer

Verified

enum myEnum { bar, foo }

for (var enumMember in myEnum) {
   console.log("enum member: ", enumMember);
}

Submitted 3 years, 6 months ago


Latest Blogs