Add TypeAlias decoration to PyTree (#66)

Doing this silences a *whole heap* of Pyright warnings that all say "Illegal type annotation: variable not allowed unless it is a type alias"
This commit is contained in:
Zac Cranko
2023-02-28 01:23:47 +00:00
committed by GitHub
parent ffc56bf782
commit 8c86958b77
+1 -1
View File
@@ -90,7 +90,7 @@ from .import_hook import install_import_hook as install_import_hook
if typing.TYPE_CHECKING:
# Set up to deliberately confuse a static type checker.
PyTree = getattr(typing, "foo" + "bar")
PyTree: typing_extensions.TypeAlias = getattr(typing, "foo" + "bar")
# What's going on with this madness?
#
# At static-type-checking-time, we want `PyTree` to be a type for which both