isinstance
check incorrectly changes type to include list[Any]
outside of the if statement
#71
Labels
rejected upstream
also a bug in pyright/pylance or feature that isn't in pyright/pylance - they refused to address it
type checking / linting
issues relating to existing diagnostic rules or proposals for new diagnostic rules
playground
this is because the if statement changes the type to
list[Any] | object
after the if statement, which is technically correct, but redundant becauseobject
is wider thanlist[Any]
so the type can be simplified to justobject
, avoiding the error. here's the same example in typescript which does simplify unions like this:playground
rejected upstream issue: microsoft/pyright#7193
The text was updated successfully, but these errors were encountered: