Skip to content

spurius "Incompatible types in assignment" with TypedDict and Type #10024

Closed
@ZeeD

Description

@ZeeD

With this little snippet of code:

from typing import *

class D(TypedDict): ...

class P(Protocol): ...

T = TypeVar('T', bound=P)

def foo(cls: Type[T]) -> T: ...

d:D = foo(D)

I have this error:

>mypy td.py
td.py:11: error: Incompatible types in assignment (expression has type "D", variable has type "D")
Found 1 error in 1 file (checked 1 source file)

It seems a wrong error - or at least the message is not meaningful

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions