types: fix cache type fallback types (#6961)

This commit is contained in:
Suneet Tipirneni
2021-11-11 13:37:53 -05:00
committed by GitHub
parent b001e194f1
commit 9f240ea0d1
2 changed files with 4 additions and 3 deletions

6
typings/index.d.ts vendored
View File

@@ -1177,11 +1177,11 @@ export type CacheTypeReducer<
RawType = CachedType,
PresentType = CachedType | RawType,
Fallback = PresentType | null,
> = State extends 'cached'
> = [State] extends ['cached']
? CachedType
: State extends 'raw'
: [State] extends ['raw']
? RawType
: State extends 'present'
: [State] extends ['present']
? PresentType
: Fallback;

View File

@@ -913,6 +913,7 @@ declare const booleanValue: boolean;
if (interaction.inGuild()) assertType<Snowflake>(interaction.guildId);
client.on('interactionCreate', async interaction => {
assertType<Snowflake | null>(interaction.guildId);
if (interaction.inCachedGuild()) {
assertType<GuildMember>(interaction.member);
// @ts-expect-error