Closed as not planned
Description
Feature
The following (mypy playground) should pass, i.e. recognize StrEnum
values as subtypes of the corresponding Literal
.
from enum import StrEnum
from typing import Literal
class Options(StrEnum):
X = "X"
Y = "Y"
x: Literal["X"] = Options.X # mypy: incompatible types in assignment
pyright
supports this feature since version 1.1.375 (playground)ty
supports it (playground)- Context: See: https://discuss.python.org/t/amend-pep-586-to-make-enum-values-subtypes-of-literal/59456