My code is basically the following:
def foo(param: Literal["a", "b"]) -> None:
...
i = input("A or B?").lower()
assert i in ["a","b"]
foo(i)
However mypy complains that it can't know that
Argument 1 to "foo" has incompatible type "str"; expected "Union[Literal['a'], Literal['b']]"
and I can't find documentation on how to convert this to a literal expression.
typing.cast