mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
refactor: Document relevant types as @internal (#9974)
* refactor: mark data resolver as internal * docs: mark relevant TypeScript symbols as `@internal` * docs: extra additions * style: prefer at end * docs: add more `@internal`s * test: update template code
This commit is contained in:
53
packages/discord.js/typings/index.d.ts
vendored
53
packages/discord.js/typings/index.d.ts
vendored
@@ -1278,21 +1278,12 @@ export class ContextMenuCommandInteraction<Cached extends CacheType = CacheType>
|
||||
private resolveContextMenuOptions(data: APIApplicationCommandInteractionData): CommandInteractionOption<Cached>[];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface ResolvedFile {
|
||||
data: Buffer;
|
||||
contentType?: string;
|
||||
}
|
||||
|
||||
export class DataResolver extends null {
|
||||
private constructor();
|
||||
public static resolveBase64(data: Base64Resolvable): string;
|
||||
public static resolveCode(data: string, regex: RegExp): string;
|
||||
public static resolveFile(resource: BufferResolvable | Stream): Promise<ResolvedFile>;
|
||||
public static resolveImage(resource: BufferResolvable | Base64Resolvable): Promise<string | null>;
|
||||
public static resolveInviteCode(data: InviteResolvable): string;
|
||||
public static resolveGuildTemplateCode(data: GuildTemplateResolvable): string;
|
||||
}
|
||||
|
||||
export class DMChannel extends TextBasedChannelMixin(BaseChannel, false, [
|
||||
'bulkDelete',
|
||||
'fetchWebhooks',
|
||||
@@ -3266,6 +3257,7 @@ export class UserFlagsBitField extends BitField<UserFlagsString> {
|
||||
public static resolve(bit?: BitFieldResolvable<UserFlagsString, number>): number;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function basename(path: string, ext?: string): string;
|
||||
export function cleanContent(str: string, channel: TextBasedChannel): string;
|
||||
export function discordSort<Key, Value extends { rawPosition: number; id: Snowflake }>(
|
||||
@@ -3274,14 +3266,19 @@ export function discordSort<Key, Value extends { rawPosition: number; id: Snowfl
|
||||
export function cleanCodeBlockContent(text: string): string;
|
||||
export function fetchRecommendedShardCount(token: string, options?: FetchRecommendedShardCountOptions): Promise<number>;
|
||||
export function flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown;
|
||||
/** @internal */
|
||||
export function makeError(obj: MakeErrorOptions): Error;
|
||||
/** @internal */
|
||||
export function makePlainError(err: Error): MakeErrorOptions;
|
||||
/** @internal */
|
||||
export function moveElementInArray(array: unknown[], element: unknown, newIndex: number, offset?: boolean): number;
|
||||
export function parseEmoji(text: string): PartialEmoji | null;
|
||||
export function resolveColor(color: ColorResolvable): number;
|
||||
/** @internal */
|
||||
export function resolvePartialEmoji(emoji: Snowflake): PartialEmojiOnlyId;
|
||||
export function resolvePartialEmoji(emoji: Emoji | EmojiIdentifierResolvable): PartialEmoji | null;
|
||||
export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
|
||||
/** @internal */
|
||||
export function setPosition<Item extends Channel | Role>(
|
||||
item: Item,
|
||||
position: number,
|
||||
@@ -3292,6 +3289,7 @@ export function setPosition<Item extends Channel | Role>(
|
||||
reason?: string,
|
||||
): Promise<{ id: Snowflake; position: number }[]>;
|
||||
export function parseWebhookURL(url: string): WebhookClientDataIdWithToken | null;
|
||||
/** @internal */
|
||||
export function transformResolved<Cached extends CacheType>(
|
||||
supportingData: SupportingInteractionResolvedData,
|
||||
data?: APIApplicationCommandInteractionData['resolved'],
|
||||
@@ -3319,11 +3317,18 @@ export interface MappedComponentTypes {
|
||||
[ComponentType.TextInput]: TextInputComponent;
|
||||
}
|
||||
|
||||
export interface ChannelCreateOptions {
|
||||
/** @internal */
|
||||
export interface CreateChannelOptions {
|
||||
allowFromUnknownGuild?: boolean;
|
||||
}
|
||||
|
||||
export function createChannel(client: Client<true>, data: APIChannel, options?: ChannelCreateOptions): Channel;
|
||||
/** @internal */
|
||||
export function createChannel(
|
||||
client: Client<true>,
|
||||
data: APIChannel,
|
||||
guild?: Guild,
|
||||
extras?: CreateChannelOptions,
|
||||
): Channel;
|
||||
|
||||
export function createComponent<Type extends keyof MappedComponentTypes>(
|
||||
data: APIMessageComponent & { type: Type },
|
||||
@@ -3374,6 +3379,19 @@ export class Formatters extends null {
|
||||
public static userMention: typeof userMention;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function resolveBase64(data: Base64Resolvable): string;
|
||||
/** @internal */
|
||||
export function resolveCode(data: string, regex: RegExp): string;
|
||||
/** @internal */
|
||||
export function resolveFile(resource: BufferResolvable | Stream): Promise<ResolvedFile>;
|
||||
/** @internal */
|
||||
export function resolveImage(resource: BufferResolvable | Base64Resolvable): Promise<string | null>;
|
||||
/** @internal */
|
||||
export function resolveInviteCode(data: InviteResolvable): string;
|
||||
/** @internal */
|
||||
export function resolveGuildTemplateCode(data: GuildTemplateResolvable): string;
|
||||
|
||||
export type ComponentData =
|
||||
| MessageActionRowComponentData
|
||||
| ModalActionRowComponentData
|
||||
@@ -3816,11 +3834,13 @@ export enum DiscordjsErrorCodes {
|
||||
GuildForumMessageRequired = 'GuildForumMessageRequired',
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface DiscordjsErrorFields<Name extends string> {
|
||||
readonly name: `${Name} [${DiscordjsErrorCodes}]`;
|
||||
get code(): DiscordjsErrorCodes;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function DiscordjsErrorMixin<Entity, Name extends string>(
|
||||
Base: Constructable<Entity>,
|
||||
name: Name,
|
||||
@@ -4369,10 +4389,13 @@ export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, type
|
||||
// to each of those classes
|
||||
|
||||
export type Constructable<Entity> = abstract new (...args: any[]) => Entity;
|
||||
|
||||
/** @internal */
|
||||
export function PartialTextBasedChannel<Entity>(
|
||||
Base?: Constructable<Entity>,
|
||||
): Constructable<Entity & PartialTextBasedChannelFields<false>>;
|
||||
|
||||
/** @internal */
|
||||
export function TextBasedChannelMixin<
|
||||
Entity,
|
||||
InGuild extends boolean = boolean,
|
||||
@@ -4413,9 +4436,12 @@ export interface TextBasedChannelFields<InGuild extends boolean = boolean>
|
||||
setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function PartialWebhookMixin<Entity>(Base?: Constructable<Entity>): Constructable<Entity & PartialWebhookFields>;
|
||||
/** @internal */
|
||||
export function WebhookMixin<Entity>(Base?: Constructable<Entity>): Constructable<Entity & WebhookFields>;
|
||||
|
||||
/** @internal */
|
||||
export interface PartialWebhookFields {
|
||||
id: Snowflake;
|
||||
get url(): string;
|
||||
@@ -4430,6 +4456,7 @@ export interface PartialWebhookFields {
|
||||
): Promise<APIMessage | Message>;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface WebhookFields extends PartialWebhookFields {
|
||||
get createdAt(): Date;
|
||||
get createdTimestamp(): number;
|
||||
@@ -5979,6 +6006,7 @@ export interface LifetimeFilterOptions<Key, Value> {
|
||||
lifetime?: number;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface MakeErrorOptions {
|
||||
name: string;
|
||||
message: string;
|
||||
@@ -6433,6 +6461,7 @@ export interface StageInstanceEditOptions {
|
||||
privacyLevel?: StageInstancePrivacyLevel;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface SupportingInteractionResolvedData {
|
||||
client: Client;
|
||||
guild?: Guild;
|
||||
|
||||
Reference in New Issue
Block a user