Skip to content

Type annotation for resolve_types isn't correct #1132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
euresti opened this issue May 2, 2023 · 0 comments · Fixed by #1141
Closed

Type annotation for resolve_types isn't correct #1132

euresti opened this issue May 2, 2023 · 0 comments · Fixed by #1141

Comments

@euresti
Copy link
Contributor

euresti commented May 2, 2023

import attr

def test(cls: type) -> None:
    if attr.has(cls):
        attr.resolve_types(cls)

Fails with foo.py:6: error: Value of type variable "_A" of "resolve_types" cannot be "Type[AttrsInstance]" [type-var]

I think the easy fix is

_A = TypeVar("_A", bound=type[AttrsInstance])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant