why did mypy complains "object" not callable when using a TypedDict alias

Viewed 538

I have file named debug.py:

from typing import TypedDict

class T(TypedDict):
    a: int


Q = T

x = Q(a=1)

when I run

mypy debug.py

I see

debug.py:9: error: "object" not callable
Found 1 error in 1 file (checked 1 source file)

If I replace x = Q(a=1) with x = T(a=1), then the complain would gone.

Using reveal_type shows

debug.py:9: note: Revealed type is 'builtins.object'
debug.py:10: note: Revealed type is 'def () -> debug.T'

Why aren't Q and T the same?

0 Answers
Related