For type checking it is very good, however, the error messages are sometimes not very human-readable. For example:
def _deep_merge(updates: dict[str, str]) -> None:
for key, update_info in updates.items():
if isinstance(update_info, dict) and "values" in update_info:
value = update_info["values"]
Errors out with Pyright:
- error: Argument of type "Literal['values']" cannot be assigned to parameter "__key" of type "SupportsIndex | slice" in function "__getitem__"
Type "Literal['values']" cannot be assigned to type "SupportsIndex | slice"
"Literal['values']" is incompatible with protocol "SupportsIndex"
"__index__" is not present
"Literal['values']" is incompatible with "slice" (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations
It took me a great amount of starring to figure out that changing the signature of updates to dict[str, dict] was what it was complaining about.
RMPR|2 years ago
It took me a great amount of starring to figure out that changing the signature of updates to dict[str, dict] was what it was complaining about.
Cannabat|2 years ago