Skip to content

(🐞) Check __setitem__ and __getitem__ for TypedDicts #12270

Open
@KotlinIsland

Description

@KotlinIsland
from typing import TypedDict

class A(TypedDict):
    x: int
a: A
a.__setitem__('x', '')  # no error
b: int = a.__getitem__('x')  # error: Incompatible types in assignment (expression has type "object", variable has type "int")

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions