typings: Refactor how channel types are done (#3808)

* refactor channel types

* really weird solution to make what the PR promises possible, I might revert this

* undo the dumb attempt

* Update index.d.ts

* fix GuildCreateChannelOptions#type

* fix(typings): remove initializers from the enum

* Update index.d.ts

Co-authored-by: Crawl <icrawltogo@gmail.com>
This commit is contained in:
didinele
2020-02-29 16:11:56 +02:00
committed by GitHub
parent a04b4cae3e
commit d33fc741e3

11
typings/index.d.ts vendored
View File

@@ -133,6 +133,7 @@ declare module 'discord.js' {
export class CategoryChannel extends GuildChannel {
public readonly children: Collection<Snowflake, GuildChannel>;
public type: 'category';
}
export class Channel extends Base {
@@ -689,6 +690,7 @@ declare module 'discord.js' {
public messages: MessageManager;
public recipient: User;
public readonly partial: false;
public type: 'dm';
public fetch(): Promise<DMChannel>;
}
@@ -861,6 +863,7 @@ declare module 'discord.js' {
public readonly permissionsLocked: boolean | null;
public readonly position: number;
public rawPosition: number;
public type: Exclude<keyof typeof ChannelType, 'dm' | 'group' | 'unknown'>;
public readonly viewable: boolean;
public clone(options?: GuildChannelCloneOptions): Promise<this>;
public createInvite(options?: InviteOptions): Promise<Invite>;
@@ -1211,6 +1214,7 @@ declare module 'discord.js' {
public messages: MessageManager;
public nsfw: boolean;
public topic: string | null;
public type: 'news';
public createWebhook(
name: string,
options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string },
@@ -1546,6 +1550,7 @@ declare module 'discord.js' {
constructor(guild: Guild, data?: object);
public messages: MessageManager;
public nsfw: boolean;
public type: 'text';
public rateLimitPerUser: number;
public topic: string | null;
public createWebhook(
@@ -1654,6 +1659,7 @@ declare module 'discord.js' {
public readonly full: boolean;
public readonly joinable: boolean;
public readonly speakable: boolean;
public type: 'voice';
public userLimit: number;
public join(): Promise<VoiceConnection>;
public leave(): void;
@@ -2512,7 +2518,10 @@ declare module 'discord.js' {
interface GuildCreateChannelOptions {
permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
topic?: string;
type?: Exclude<keyof typeof ChannelType, 'dm' | 'group' | 'unknown'>;
type?: Exclude<
keyof typeof ChannelType | ChannelType,
'dm' | 'group' | 'unknown' | ChannelType.dm | ChannelType.group | ChannelType.unknown
>;
nsfw?: boolean;
parent?: ChannelResolvable;
bitrate?: number;