Skip to content

Commit e50b5a8

Browse files
committed
🐛 Fix TypeError when typing ui.Select
1 parent d5d162a commit e50b5a8

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

discord/ui/select.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
import sys
3131
from collections.abc import Sequence
3232
from functools import partial
33-
from typing import TYPE_CHECKING, Any, Callable, Generic, Literal, TypeVar, overload
33+
from typing import TYPE_CHECKING, Any, Callable, Generic, Literal, overload
34+
35+
from typing_extensions import TypeVar
3436

3537
from ..channel import _threaded_guild_channel_factory
3638
from ..components import SelectDefaultValue, SelectMenu, SelectOption
@@ -62,25 +64,18 @@
6264
)
6365

6466
if TYPE_CHECKING:
65-
from typing_extensions import Self
66-
6767
from ..abc import GuildChannel, Snowflake
6868
from ..types.components import SelectMenu as SelectMenuPayload
6969
from ..types.interactions import ComponentInteractionData
7070
from .view import View
7171

72-
ST = TypeVar("ST", bound=Snowflake | str, covariant=True, default=Any)
73-
else:
74-
if sys.version_info >= (3, 13):
75-
ST = TypeVar("ST", bound="Snowflake | str", covariant=True, default=Any)
76-
else:
77-
ST = TypeVar("ST", bound="Snowflake | str", covariant=True)
72+
ST = TypeVar("ST", bound=Snowflake | str, covariant=True, default=Any)
7873

7974
S = TypeVar("S", bound="Select")
8075
V = TypeVar("V", bound="View", covariant=True)
8176

8277

83-
class Select(Generic[V, ST], Item[V]):
78+
class Select(Item[V], Generic[V, ST]):
8479
"""Represents a UI select menu.
8580
8681
This is usually represented as a drop down menu.

requirements/_.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
aiohttp>=3.6.0,<4.0
2-
typing_extensions>=4.5.0,<5
2+
typing_extensions>=4.12.0,<5

0 commit comments

Comments
 (0)