Skip to content

Commit

Permalink
fix(typing): use AnySelectMenuPayload for BaseSelectMenu.__init__
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv committed Nov 15, 2023
1 parent b6986e5 commit bfcbf84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion disnake/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from .emoji import Emoji
from .types.components import (
ActionRow as ActionRowPayload,
AnySelectMenu as AnySelectMenuPayload,
BaseSelectMenu as BaseSelectMenuPayload,
ButtonComponent as ButtonComponentPayload,
ChannelSelectMenu as ChannelSelectMenuPayload,
Expand Down Expand Up @@ -275,7 +276,10 @@ class BaseSelectMenu(Component):

__repr_info__: ClassVar[Tuple[str, ...]] = __slots__

def __init__(self, data: BaseSelectMenuPayload) -> None:
# n.b: ideally this would be `BaseSelectMenuPayload`,
# but pyright made TypedDict keys invariant and doesn't
# fully support readonly items yet (which would help avoid this)
def __init__(self, data: AnySelectMenuPayload) -> None:
component_type = try_enum(ComponentType, data["type"])
self.type: SelectMenuType = component_type # type: ignore

Expand Down

0 comments on commit bfcbf84

Please sign in to comment.