Is it possible to create a class like
from typing import Union, Literal
class Foo:
bar: Union[str, int]
qux: Literal["str", "int"]
such that, if qux is Literal["str"], then bar is of type str, and if qux is Literal["int"], then bar is of type int? Is it possible to annotate that?
I'm aware of typing.overload, but I don't think it's relevant for this example