Skip to content

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

Closed
@MarcoGorelli

Description

@MarcoGorelli

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    assert-typeassert_type()bugmypy got something wrongtopic-type-aliasTypeAlias and other type alias issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions