Fix remaining type errors in main package

This doesn't fix the type errors in the ext packages though.
This commit is contained in:
Rapptz
2022-02-22 04:19:46 -05:00
parent 3e90664cf9
commit 8d52ddaff6
3 changed files with 9 additions and 9 deletions

View File

@@ -72,7 +72,7 @@ if TYPE_CHECKING:
from .types.snowflake import Snowflake
from .types.activity import Activity as ActivityPayload
from .types.channel import DMChannel as DMChannelPayload
from .types.user import User as UserPayload
from .types.user import User as UserPayload, PartialUser as PartialUserPayload
from .types.emoji import Emoji as EmojiPayload
from .types.sticker import GuildSticker as GuildStickerPayload
from .types.guild import Guild as GuildPayload
@@ -314,7 +314,7 @@ class ConnectionState:
for vc in self.voice_clients:
vc.main_ws = ws # type: ignore - Silencing the unknown attribute (ok at runtime).
def store_user(self, data):
def store_user(self, data: Union[UserPayload, PartialUserPayload]) -> User:
# this way is 300% faster than `dict.setdefault`.
user_id = int(data['id'])
try:
@@ -328,7 +328,7 @@ class ConnectionState:
def store_user_no_intents(self, data):
return User(state=self, data=data)
def create_user(self, data: UserPayload) -> User:
def create_user(self, data: Union[UserPayload, PartialUserPayload]) -> User:
return User(state=self, data=data)
def get_user(self, id):