mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
feat: Backport cache types resolving to never (#7561)
This commit is contained in:
@@ -944,7 +944,28 @@ expectDeprecated(sticker.deleted);
|
||||
// Test interactions
|
||||
declare const interaction: Interaction;
|
||||
declare const booleanValue: boolean;
|
||||
if (interaction.inGuild()) expectType<Snowflake>(interaction.guildId);
|
||||
if (interaction.inGuild()) {
|
||||
expectType<Snowflake>(interaction.guildId);
|
||||
} else {
|
||||
expectType<Snowflake | null>(interaction.guildId);
|
||||
}
|
||||
|
||||
client.on('interactionCreate', interaction => {
|
||||
// This is for testing never type resolution
|
||||
if (!interaction.inGuild()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.inRawGuild()) {
|
||||
expectNotType<never>(interaction);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interaction.inCachedGuild()) {
|
||||
expectNotType<never>(interaction);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
client.on('interactionCreate', async interaction => {
|
||||
if (interaction.inCachedGuild()) {
|
||||
|
||||
Reference in New Issue
Block a user