types: fix regressions and inconsistencies (#7260)

This commit is contained in:
Rodry
2022-01-17 15:45:23 +00:00
committed by GitHub
parent 18b0ed4cbe
commit 26a9dc3206
2 changed files with 12 additions and 15 deletions

View File

@@ -188,7 +188,7 @@ export abstract class AnonymousGuild extends BaseGuild {
protected constructor(client: Client, data: RawAnonymousGuildData, immediatePatch?: boolean); protected constructor(client: Client, data: RawAnonymousGuildData, immediatePatch?: boolean);
public banner: string | null; public banner: string | null;
public description: string | null; public description: string | null;
public nsfwLevel: GuildNSFWLevel; public nsfwLevel: GuildNSFWLevelKey;
public splash: string | null; public splash: string | null;
public vanityURLCode: string | null; public vanityURLCode: string | null;
public verificationLevel: GuildVerificationLevelKey; public verificationLevel: GuildVerificationLevelKey;
@@ -500,10 +500,7 @@ export class CategoryChannel extends GuildChannel {
name: string, name: string,
options: CategoryCreateChannelOptions & { type: 'GuildStore' | ChannelType.GuildStore }, options: CategoryCreateChannelOptions & { type: 'GuildStore' | ChannelType.GuildStore },
): Promise<StoreChannel>; ): Promise<StoreChannel>;
public createChannel( public createChannel(name: string, options?: CategoryCreateChannelOptions): Promise<TextChannel>;
name: string,
options?: CategoryCreateChannelOptions,
): Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>;
} }
export type CategoryChannelResolvable = Snowflake | CategoryChannel; export type CategoryChannelResolvable = Snowflake | CategoryChannel;
@@ -1339,7 +1336,7 @@ export class InteractionCollector<T extends Interaction> extends Collector<Snowf
private _handleGuildDeletion(guild: Guild): void; private _handleGuildDeletion(guild: Guild): void;
public channelId: Snowflake | null; public channelId: Snowflake | null;
public componentType: MessageComponentTypeKey | null; public componentType: ComponentTypeKey | null;
public readonly endReason: string | null; public readonly endReason: string | null;
public guildId: Snowflake | null; public guildId: Snowflake | null;
public interactionType: InteractionType | null; public interactionType: InteractionType | null;
@@ -1498,7 +1495,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
public system: boolean; public system: boolean;
public readonly thread: ThreadChannel | null; public readonly thread: ThreadChannel | null;
public tts: boolean; public tts: boolean;
public type: MessageType; public type: MessageTypeKey;
public readonly url: string; public readonly url: string;
public webhookId: Snowflake | null; public webhookId: Snowflake | null;
public flags: Readonly<MessageFlags>; public flags: Readonly<MessageFlags>;
@@ -1600,7 +1597,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
public update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>; public update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
public update(options: string | MessagePayload | InteractionUpdateOptions): Promise<void>; public update(options: string | MessagePayload | InteractionUpdateOptions): Promise<void>;
public static resolveType(type: MessageComponentTypeResolvable): MessageComponentTypeKey; public static resolveType(type: MessageComponentTypeResolvable): ComponentTypeKey;
} }
export class MessageContextMenuCommandInteraction< export class MessageContextMenuCommandInteraction<
@@ -2799,7 +2796,7 @@ export class ApplicationCommandPermissionsManager<
private static transformPermissions( private static transformPermissions(
permissions: ApplicationCommandPermissionData, permissions: ApplicationCommandPermissionData,
received: true, received: true,
): Omit<APIApplicationCommandPermission, 'type'> & { type: keyof ApplicationCommandPermissionType }; ): Omit<APIApplicationCommandPermission, 'type'> & { type: keyof typeof ApplicationCommandPermissionType };
private static transformPermissions(permissions: ApplicationCommandPermissionData): APIApplicationCommandPermission; private static transformPermissions(permissions: ApplicationCommandPermissionData): APIApplicationCommandPermission;
} }
@@ -3465,7 +3462,7 @@ export interface ThreadMemberFetchOptions extends BaseFetchOptions {
} }
export interface BaseMessageComponentOptions { export interface BaseMessageComponentOptions {
type?: MessageComponentTypeKey | ComponentType; type?: ComponentTypeKey | ComponentType;
} }
export type BitFieldResolvable<T extends string, N extends number | bigint> = export type BitFieldResolvable<T extends string, N extends number | bigint> =
@@ -4523,7 +4520,7 @@ export type IntegrationType = 'twitch' | 'youtube' | 'discord';
export interface InteractionCollectorOptions<T extends Interaction, Cached extends CacheType = CacheType> export interface InteractionCollectorOptions<T extends Interaction, Cached extends CacheType = CacheType>
extends CollectorOptions<[T]> { extends CollectorOptions<[T]> {
channel?: TextBasedChannel; channel?: TextBasedChannel;
componentType?: ComponentType | MessageComponentTypeKey; componentType?: ComponentType | ComponentTypeKey;
guild?: Guild; guild?: Guild;
interactionType?: InteractionTypeKey | InteractionType; interactionType?: InteractionTypeKey | InteractionType;
max?: number; max?: number;
@@ -4690,9 +4687,9 @@ export type MessageComponentOptions =
| MessageButtonOptions | MessageButtonOptions
| MessageSelectMenuOptions; | MessageSelectMenuOptions;
export type MessageComponentTypeKey = keyof typeof ComponentType; export type ComponentTypeKey = keyof typeof ComponentType;
export type MessageComponentTypeResolvable = MessageComponentTypeKey | ComponentType; export type MessageComponentTypeResolvable = ComponentTypeKey | ComponentType;
export interface MessageEditOptions { export interface MessageEditOptions {
attachments?: MessageAttachment[]; attachments?: MessageAttachment[];

View File

@@ -861,8 +861,8 @@ declare const categoryChannel: CategoryChannel;
expectType<Promise<NewsChannel>>(categoryChannel.createChannel('name', { type: 'GuildNews' })); expectType<Promise<NewsChannel>>(categoryChannel.createChannel('name', { type: 'GuildNews' }));
expectDeprecated(categoryChannel.createChannel('name', { type: 'GuildStore' })); expectDeprecated(categoryChannel.createChannel('name', { type: 'GuildStore' }));
expectType<Promise<StageChannel>>(categoryChannel.createChannel('name', { type: 'GuildStageVoice' })); expectType<Promise<StageChannel>>(categoryChannel.createChannel('name', { type: 'GuildStageVoice' }));
expectType<Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>>(categoryChannel.createChannel('name', {})); expectType<Promise<TextChannel>>(categoryChannel.createChannel('name', {}));
expectType<Promise<Exclude<NonThreadGuildBasedChannel, CategoryChannel>>>(categoryChannel.createChannel('name')); expectType<Promise<TextChannel>>(categoryChannel.createChannel('name'));
} }
declare const guildChannelManager: GuildChannelManager; declare const guildChannelManager: GuildChannelManager;