Skip to content

Add support for TypeAliasType #16614

Closed
@ks-mw

Description

@ks-mw

Bug Report

Creating a simple TypeAliasType results in mypy reporting a type error.

To Reproduce

from typing_extensions import TypeAliasType
TestType = TypeAliasType("TestType", int)
x: TestType = 42

Playground:
https://mypy-play.net/?mypy=latest&python=3.11&gist=294b3a573ab591aa3026f7c05645c809

Gist:
https://gist.github.com/mypy-play/294b3a573ab591aa3026f7c05645c809

Expected Behavior

No type error should be reported.

Actual Behavior

mypy reports: main.py:3: error: Variable "__main__.TestType" is not valid as a type [valid-type]

Your Environment

  • Mypy version used: 1.7.1
  • Python version used: 3.11, 3.10

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions