Skip to content

Support generic "manual" PEP 695 type aliases #1737

@sharkdp

Description

@sharkdp

Support generic PEP 695 aliases if they are manually constructed via TypeAliasType(…):

from typing import TypeAliasType, TypeVar, reveal_type

K = TypeVar("K")
V = TypeVar("V")

MyDict = TypeAliasType("MyDict", dict[K, V], type_params=(K, V))


def _(x: MyDict[str, int]):
    reveal_type(x)  # should be: dict[str, int]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions