Skip to content

Expression is of type "type[int]", not "type[int]" when using assert_type and TypeAlias #18974

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
MarcoGorelli opened this issue Apr 26, 2025 · 0 comments · Fixed by #18975
Closed
Labels
assert-type assert_type() bug mypy got something wrong topic-type-alias TypeAlias and other type alias issues

Comments

@MarcoGorelli
Copy link
Contributor

Bug Report

(A clear and concise description of what the bug is.)

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.12&gist=f8dfcc539a523e88dc63f9e6bb423d40

from typing import TypeAlias
from typing_extensions import assert_type

a: TypeAlias = int

assert_type(a, type[int])

Expected Behavior

No issues reported

Actual Behavior

g.py:6: error: Expression is of type "type[int]", not "type[int]"  [assert-type]
    assert_type(a, type[int])

Your Environment

  • Mypy version used: mypy g.py
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.12.8
@MarcoGorelli MarcoGorelli added the bug mypy got something wrong label Apr 26, 2025
@sterliakov sterliakov added topic-type-alias TypeAlias and other type alias issues assert-type assert_type() labels Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert-type assert_type() bug mypy got something wrong topic-type-alias TypeAlias and other type alias issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants