From 0a13ae5f2aea56d986c3f595746ede15833a8284 Mon Sep 17 00:00:00 2001 From: hiro-nikaitou Date: Sun, 12 Jul 2026 20:16:10 +0800 Subject: [PATCH] [Type] Fix alias type annotation on Attribute class The alias attribute on Attribute instances is always resolved to str before being exposed to users (via the class builder), so the type should be str, not str | None. Closes #1540 --- src/attr/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/attr/__init__.pyi b/src/attr/__init__.pyi index 758decf8f..ee9f2127f 100644 --- a/src/attr/__init__.pyi +++ b/src/attr/__init__.pyi @@ -136,7 +136,7 @@ class Attribute(Generic[_T]): type: type[_T] | None kw_only: bool on_setattr: _OnSetAttrType - alias: str | None + alias: str def evolve(self, **changes: Any) -> "Attribute[Any]": ...