feat: backport (#7776)

This commit is contained in:
Jiralite
2022-04-19 14:59:05 +01:00
committed by GitHub
parent 7afcd9594a
commit 5165b18b85
3 changed files with 41 additions and 16 deletions

5
typings/index.d.ts vendored
View File

@@ -4603,7 +4603,10 @@ export interface FetchBanOptions extends BaseFetchOptions {
}
export interface FetchBansOptions {
cache: boolean;
limit?: number;
before?: Snowflake;
after?: Snowflake;
cache?: boolean;
}
export interface FetchChannelOptions extends BaseFetchOptions {

View File

@@ -94,6 +94,8 @@ import {
MessageSelectMenu,
PartialDMChannel,
InteractionResponseFields,
GuildBan,
GuildBanManager,
} from '.';
import type { ApplicationCommandOptionTypes } from './enums';
import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd';
@@ -891,6 +893,20 @@ expectType<Promise<Collection<Snowflake, GuildEmoji>>>(guildEmojiManager.fetch()
expectType<Promise<Collection<Snowflake, GuildEmoji>>>(guildEmojiManager.fetch(undefined, {}));
expectType<Promise<GuildEmoji>>(guildEmojiManager.fetch('0'));
declare const guildBanManager: GuildBanManager;
{
expectType<Promise<GuildBan>>(guildBanManager.fetch('1234567890'));
expectType<Promise<GuildBan>>(guildBanManager.fetch({ user: '1234567890' }));
expectType<Promise<GuildBan>>(guildBanManager.fetch({ user: '1234567890', cache: true, force: false }));
expectType<Promise<Collection<Snowflake, GuildBan>>>(guildBanManager.fetch());
expectType<Promise<Collection<Snowflake, GuildBan>>>(guildBanManager.fetch({}));
expectType<Promise<Collection<Snowflake, GuildBan>>>(guildBanManager.fetch({ limit: 100, before: '1234567890' }));
// @ts-expect-error
guildBanManager.fetch({ cache: true, force: false });
// @ts-expect-error
guildBanManager.fetch({ user: '1234567890', after: '1234567890', cache: true, force: false });
}
declare const typing: Typing;
expectType<PartialUser>(typing.user);
if (typing.user.partial) expectType<null>(typing.user.username);