New to mypy and I'm having trouble finding the right way to get types working when filtering optionals from collections.
from typing import Optional, List
list1: List[Optional[int]] = [1, None, 3]
# This type is an error, filter can't even handle a list with optionals
list2: List[int] = list(filter(lambda n: n is not None, list1))
Should I be casting this? Should mypy be able to infer that None is filtered out now?