Open DetachHead opened 1 year ago
from typing import TypeVar, TypeAlias T = TypeVar("T") MaybeList = T | list[T] # error: Type variable "__main__.T" is invalid as target for type alias MaybeList2: TypeAlias = T | list[T] # no error
playground
related to: #13376
workaround: use new python 3.12 type alias syntax
type MaybeList[T] = T | list[T]
playground