From the Python documentation of typing.TypeAlias
:
Deprecated since version 3.12:
TypeAlias
is deprecated in favor of thetype
statement, which creates instances ofTypeAliasType
and which natively supports forward references. Note that whileTypeAlias
andTypeAliasType
serve similar purposes and have similar names, they are distinct and the latter is not the type of the former. Removal ofTypeAlias
is not currently planned, but users are encouraged to migrate totype
statements.
Especially the final sentence is relevant here. I think it’s fair to call TypeAlias
soft deprecated, since for most use-cases you should just use a type
statement instead. So the deprecation in this case is about nudging people towards using the superior[1] construct for the intended use-case of TypeAlias
, not necessarily about preventing people from using it at all.
For now you can keep using TypeAlias
for those other use-cases if you like[2], with no imminent danger of your code breaking in the future. If your preference is to use TypeAlias
this way, that’s fine, but I don’t think that should restrict the design of TypeAliasType
.