Closed mgedmin closed 1 week ago
I think this is a reasonable enhancement request. It appears that mypy has support for this, although it doesn't deal with all edge cases correctly.
I'll look at adding this to pyright.
This will be included in the next release.
This is addressed in pyright 1.1.389
Describe the bug
Pyright seems to not understand that a TypedDict with at least one required field will be considered true in a boolean context, and therefore the type of
a_typed_dict_or_none and some_other_thing
will either be NoneType or the type ofsome_other_thing
.Code or Screenshots
which produces a
Mypy has no issues with this code.
VS Code extension or command-line Are you running pyright as a VS Code extension, a language server in another editor, integrated into Pylance, or the command-line tool? Which version?
Command-line tool, version 1.1.388