diff --git a/stdlib/xml/dom/minicompat.pyi b/stdlib/xml/dom/minicompat.pyi index 4507b3d98..4d83bef02 100644 --- a/stdlib/xml/dom/minicompat.pyi +++ b/stdlib/xml/dom/minicompat.pyi @@ -1,5 +1,6 @@ from collections.abc import Iterable from typing import Any, TypeVar +from typing_extensions import Literal __all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"] @@ -8,11 +9,13 @@ _T = TypeVar("_T") StringTypes: tuple[type[str]] class NodeList(list[_T]): - length: int + @property + def length(self) -> int: ... def item(self, index: int) -> _T | None: ... -class EmptyNodeList(tuple[Any, ...]): - length: int +class EmptyNodeList(tuple[()]): + @property + def length(self) -> Literal[0]: ... def item(self, index: int) -> None: ... def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore[override] def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ...