diff --git a/discord/ui/action_row.py b/discord/ui/action_row.py index cc25f618f..41471c9d8 100644 --- a/discord/ui/action_row.py +++ b/discord/ui/action_row.py @@ -67,6 +67,7 @@ if TYPE_CHECKING: from ..components import SelectOption from ..interactions import Interaction from .container import Container + from .dynamic import DynamicItem SelectCallbackDecorator = Callable[[ItemCallbackType['S', BaseSelectT]], BaseSelectT] @@ -194,7 +195,7 @@ class ActionRow(Item[V]): # it should error anyways. return True - def _swap_item(self, base, new, custom_id) -> None: + def _swap_item(self, base: Item, new: DynamicItem, custom_id: str) -> None: child_index = self._children.index(base) self._children[child_index] = new # type: ignore diff --git a/discord/ui/container.py b/discord/ui/container.py index a20310239..67a58a6b4 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -50,6 +50,7 @@ if TYPE_CHECKING: from ..components import Container as ContainerComponent from ..interactions import Interaction + from .dynamic import DynamicItem S = TypeVar('S', bound='Container', covariant=True) V = TypeVar('V', bound='LayoutView', covariant=True) @@ -198,7 +199,7 @@ class Container(Item[V]): def _has_children(self): return True - def _swap_item(self, base, new, custom_id) -> None: + def _swap_item(self, base: Item, new: DynamicItem, custom_id: str) -> None: child_index = self._children.index(base) self._children[child_index] = new # type: ignore diff --git a/discord/ui/section.py b/discord/ui/section.py index 31a5ef412..c620597cc 100644 --- a/discord/ui/section.py +++ b/discord/ui/section.py @@ -35,6 +35,7 @@ if TYPE_CHECKING: from typing_extensions import Self from .view import LayoutView + from .dynamic import DynamicItem from ..components import SectionComponent V = TypeVar('V', bound='LayoutView', covariant=True) @@ -111,7 +112,7 @@ class Section(Item[V]): def _is_v2(self) -> bool: return True - def _swap_item(self, base, new, custom_id) -> None: + def _swap_item(self, base: Item, new: DynamicItem, custom_id: str) -> None: if self.accessory.is_dispatchable() and getattr(self.accessory, 'custom_id', None) == custom_id: self.accessory = new # type: ignore