isinstance(..., dict) assumes unknown parameters #9376
Replies: 1 comment
-
Mypy doesn't distinguish between explicit The way I typically avoid generating an # pyright: strict
type JSON = dict[str, JSON] | list[JSON] | str | float | None
data: JSON = json.loads("...")
if isinstance(data, dict):
reveal_type(data) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried this feature with mypy, and there is no problem, because it assumes that the object is of type dict[Any, Any]
But Pyright assumes as dict[Unknown, Unknown]
How can I check that the object is a dict without getting this error in strict mode?
Beta Was this translation helpful? Give feedback.
All reactions