Skip to content

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

Closed

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

Activity

  1. added
    bugmypy got something wrong
    on Feb 4, 2021
  2. AlexWaygood commented on Apr 22, 2022

    @AlexWaygood
    Member

    I'm closing this in favour of #12385, which is a newer issue but has more discussion attached to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions