diff --git a/traitlets/traitlets.py b/traitlets/traitlets.py index 0f487e0e..4aa08cf3 100644 --- a/traitlets/traitlets.py +++ b/traitlets/traitlets.py @@ -505,6 +505,11 @@ def instance_init(self, obj: t.Any) -> None: K = TypeVar("K", default=str) V = TypeVar("V", default=t.Any) +else: + # This is required to avoid warnings about unresolved references when generating + # the documentation of downstream projects. + K = TypeVar("K") + V = TypeVar("V") # We use a type for the getter (G) and setter (G) because we allow