Check TypedDict items [typeddict-item]

When constructing a TypedDict object, mypy checks that each key and value is compatiblewith the TypedDict type that is inferred from the surrounding context.

Example:

  1. from typing_extensions import TypedDict
  2.  
  3. class Point(TypedDict):
  4. x: int
  5. y: int
  6.  
  7. # Error: Incompatible types (expression has type "float",
  8. # TypedDict item "x" has type "int") [typeddict-item]
  9. p: Point = {'x': 1.2, 'y': 4}