Say we have
from typing import List
a: List[int] | List[str]
if all(isinstance(i, int) for i in a):
reveal_type(a)
This gives us
main.py:6: note: Revealed type is "Union[builtins.list[builtins.int], builtins.list[builtins.str]]"
Is there a way to get mypy to recognise that a is a list of integers, or is the only solution here to use cast?