diff --git a/discord/utils.py b/discord/utils.py index db9f84195..9fb9e22dd 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -46,6 +46,7 @@ from typing import ( Protocol, Set, Sequence, + SupportsIndex, Tuple, Type, TypeVar, @@ -227,7 +228,15 @@ class SequenceProxy(Sequence[T_co]): def __repr__(self) -> str: return f"SequenceProxy({self.__proxied!r})" - def __getitem__(self, idx: int) -> T_co: + @overload + def __getitem__(self, idx: SupportsIndex) -> T_co: + ... + + @overload + def __getitem__(self, idx: slice) -> List[T_co]: + ... + + def __getitem__(self, idx: Union[SupportsIndex, slice]) -> Union[T_co, List[T_co]]: return self.__copied[idx] def __len__(self) -> int: