Closed
Description
Mypy reports no error for this program:
from typing import ReadOnly, TypedDict, NotRequired
class TD(TypedDict):
x: ReadOnly[NotRequired[int]]
def f(td: TD):
td.pop("x")
https://mypy-play.net/?mypy=latest&python=3.13&gist=9dfad53c9dc2e22c63548a553afdb67e
But deleting a ReadOnly key should not be allowed. The spec says:
The typing.ReadOnly type qualifier is used to indicate that an item declared in a TypedDict definition may not be mutated (added, modified, or removed)