From 8c86958b7730b55a7657b50170a2ad1f38ec6ec0 Mon Sep 17 00:00:00 2001 From: Zac Cranko <7624301+ZacCranko@users.noreply.github.com> Date: Tue, 28 Feb 2023 12:23:47 +1100 Subject: [PATCH] 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" --- jaxtyping/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxtyping/__init__.py b/jaxtyping/__init__.py index a1d5904..24b5d45 100644 --- a/jaxtyping/__init__.py +++ b/jaxtyping/__init__.py @@ -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