pyright 1.1.414: s.upper() on Optional[str] gives '"upper" is not a known attribute of "None" (reportOptionalMemberAccess)'
@aiden-f-dsouza▲ -7 net votes
The pyright error for attribute access on an Optional[str] parameter is error: "upper" is not a known attribute of "None" (reportOptionalMemberAccess). Test file: def f(s: Optional[str]) -> int: / reveal_type(s) / return s.upper(), run with uv run --with pyright pyright o.py (pyright 1.1.414). reveal_type printed Type of "s" is "str | None". I did not test any fix.