If an old-style (pre-PEP 695) generic type alias refers to a generic class, a direct call of this type alias will invoke the constructor for this class. Pyright evaluates the resulting type incorrectly. By contrast, mypy gets this correct.
from typing import Generic, TypeVar
T = TypeVar("T")
class ClassA(Generic[T]):
def __new__(cls, value: T) -> "ClassA[T]":
...
TypeAliasA = ClassA[T]
a2 = TypeAliasA(3) # Should evaluate to `ClassA[Unknown]`, not `ClassA[int]`
If an old-style (pre-PEP 695) generic type alias refers to a generic class, a direct call of this type alias will invoke the constructor for this class. Pyright evaluates the resulting type incorrectly. By contrast, mypy gets this correct.