Closed
Description
I would expect type hints would be evaluated for iterables which are filtered by some conditional function:
li: List[Optional[Union[str]]] = ["hello", "test", None]
filtered_li = list(filter(lambda el: el is not None, li)) # type: List[str | None]
Specifically, because list comprehension provides correct type hinting:
filtered_li = [el for el in li if el is not None] # type: List[str]
I am suggesting we adopt a similar behavior for filter functions as is done for list comprehension. Open to discussion regarding the implementation semantics.