2929import math
3030from collections import defaultdict
3131from types import MappingProxyType
32- from typing import TYPE_CHECKING , Any , Literal , NamedTuple , Self , Unpack , overload
32+ from typing import TYPE_CHECKING , Any , Literal , NamedTuple , Self , Unpack , cast , overload
3333
3434from .authentication import ManagedHTTPClient , Scopes , UserTokenPayload
3535from .eventsub .enums import SubscriptionType
@@ -149,12 +149,14 @@ def __init__(
149149 msg = "If you require the StarletteAdapter please install the required packages: 'pip install twitchio[starlette]'."
150150 logger .warning (msg )
151151
152- adapter : BaseAdapter | type [BaseAdapter ] = options .get ("adapter" , AiohttpAdapter )
152+ adapter : BaseAdapter [Any ] | type [BaseAdapter [Any ]] | type [AiohttpAdapter [Self ]] = options .get ( # type: ignore
153+ "adapter" , AiohttpAdapter
154+ )
153155 if isinstance (adapter , BaseAdapter ):
154156 adapter .client = self
155157 self ._adapter = adapter
156158 else :
157- self ._adapter = adapter ()
159+ self ._adapter = cast ( "AiohttpAdapter[Self]" , adapter () )
158160 self ._adapter .client = self
159161
160162 # Own Client User. Set in login...
@@ -178,12 +180,12 @@ def __init__(
178180 self ._setup_called = False
179181
180182 @property
181- def adapter (self ) -> BaseAdapter :
183+ def adapter (self ) -> BaseAdapter [ Any ] :
182184 """Property returning the :class:`~twitchio.AiohttpAdapter` or :class:`~twitchio.StarlettepAdapter` the bot is
183185 currently running."""
184186 return self ._adapter
185187
186- async def set_adapter (self , adapter : BaseAdapter ) -> None :
188+ async def set_adapter (self , adapter : BaseAdapter [ Any ] ) -> None :
187189 """|coro|
188190
189191 Method which sets and starts a new web adapter which inherits from either :class:`~twitchio.AiohttpAdapter` or
0 commit comments