UP: Rule for rewriting typing_extensions.TypeAliasType
as type ...
on Python 3.12
#11422
Labels
rule
Implementing or modifying a lint rule
On Python 3.12, the new type alias syntax,
type X = Y
, produces atyping.TypeAliasType
object, which has been backported totyping_extensions
.And pydantic makes use of this
typing_extensions.TypeAliasType
: https://docs.pydantic.dev/latest/concepts/types/#named-type-aliasesFrom the pydantic docs:
(Why aren't they just using
TypeAlias
? Because then pydantic can't access the name of the alias. And there are also problems with recursive aliases.)It would be nice if this could automatically be rewritten to
on Python 3.12.
This should be an entirely safe fix, because it's just different syntax to produce the same result.
The text was updated successfully, but these errors were encountered: