We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReadOnly was implemented in #17644. I think the implementation is incomplete -- this generates a false positive:
from typing import TypedDict from typing_extensions import ReadOnly class A(TypedDict): name: ReadOnly[str | None] class B(TypedDict): name: str def f(a: A) -> None: ... b: B = {"name": "x"} f(b) # Incompatible type "B"; expected "A"
Extract from PEP 705:
Read-only items behave covariantly, as they cannot be mutated.
cc @sobolevn
The text was updated successfully, but these errors were encountered:
Yes, I agree. I will fix this before 1.12
Sorry, something went wrong.
Make ReadOnly TypedDict items covariant
6dc02b4
Fixes #17901.
@sobolevn I created a fix since it was pretty simple (#17904).
e126ba0
Make ReadOnly TypedDict items covariant (#17904)
964a7a5
sobolevn
Successfully merging a pull request may close this issue.
ReadOnly was implemented in #17644. I think the implementation is incomplete -- this generates a false positive:
Extract from PEP 705:
cc @sobolevn
The text was updated successfully, but these errors were encountered: