From 78d512c347320e5d4bf97f7f0c89d3469d923af8 Mon Sep 17 00:00:00 2001 From: Almeida Date: Mon, 26 May 2025 18:41:08 +0100 Subject: [PATCH] docs: export all visible symbols (#10760) * docs: export all visible symbols * fix: discord.js except raw * refactor: remove raw data types * docs: add back discord.js tsdoc file * refactor: remove underscores * fix: merge * docs(RPCRedis): make `promises` as internal --------- Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../brokers/src/brokers/redis/RPCRedis.ts | 3 + packages/builders/src/index.ts | 2 +- packages/collection/src/collection.ts | 6 - packages/discord.js/.gitignore | 1 - packages/discord.js/scripts/esmDts.mjs | 36 +- packages/discord.js/src/index.js | 12 +- packages/discord.js/src/util/Util.js | 19 +- packages/discord.js/tsdoc.json | 13 + packages/discord.js/typings/index.d.ts | 605 ++++++++---------- packages/discord.js/typings/index.test-d.ts | 375 ++++++----- packages/discord.js/typings/rawDataTypes.d.ts | 208 ------ .../rest/src/lib/errors/DiscordAPIError.ts | 10 +- packages/rest/src/lib/utils/types.ts | 6 - packages/rest/src/shared.ts | 1 + packages/voice/src/VoiceConnection.ts | 6 +- packages/voice/src/audio/AudioPlayer.ts | 6 +- packages/voice/src/audio/index.ts | 2 +- packages/voice/src/index.ts | 18 + packages/voice/src/networking/Networking.ts | 8 +- 19 files changed, 533 insertions(+), 804 deletions(-) create mode 100644 packages/discord.js/tsdoc.json delete mode 100644 packages/discord.js/typings/rawDataTypes.d.ts diff --git a/packages/brokers/src/brokers/redis/RPCRedis.ts b/packages/brokers/src/brokers/redis/RPCRedis.ts index 31a2d95e7..578862767 100644 --- a/packages/brokers/src/brokers/redis/RPCRedis.ts +++ b/packages/brokers/src/brokers/redis/RPCRedis.ts @@ -63,6 +63,9 @@ export class RPCRedisBroker, TResponses ex */ protected override readonly options: Required; + /** + * @internal + */ protected readonly promises = new Map(); public constructor(redisClient: Redis, options: RPCRedisBrokerOptions) { diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts index ce05bcf96..73ce18e3e 100644 --- a/packages/builders/src/index.ts +++ b/packages/builders/src/index.ts @@ -86,7 +86,7 @@ export * from './messages/MessageReference.js'; export * from './util/componentUtil.js'; export * from './util/normalizeArray.js'; export * from './util/resolveBuilder.js'; -export * from './util/validation.js'; +export { disableValidators, enableValidators, isValidationEnabled } from './util/validation.js'; export * from './Assertions.js'; diff --git a/packages/collection/src/collection.ts b/packages/collection/src/collection.ts index 0ddbd83d5..0d5e570e5 100644 --- a/packages/collection/src/collection.ts +++ b/packages/collection/src/collection.ts @@ -1106,12 +1106,6 @@ export class Collection extends Map { declare public static readonly [Symbol.species]: typeof Collection; } -/** - * @internal - */ export type Keep = { keep: false } | { keep: true; value: Value }; -/** - * @internal - */ export type Comparator = (firstValue: Value, secondValue: Value, firstKey: Key, secondKey: Key) => number; diff --git a/packages/discord.js/.gitignore b/packages/discord.js/.gitignore index 0c19eca3e..3e600f8d9 100644 --- a/packages/discord.js/.gitignore +++ b/packages/discord.js/.gitignore @@ -28,4 +28,3 @@ docs/**/* # Generated files typings/index.d.mts -typings/rawDataTypes.d.mts diff --git a/packages/discord.js/scripts/esmDts.mjs b/packages/discord.js/scripts/esmDts.mjs index 8fc490561..417276127 100644 --- a/packages/discord.js/scripts/esmDts.mjs +++ b/packages/discord.js/scripts/esmDts.mjs @@ -1,38 +1,6 @@ -import { readFile, writeFile } from 'node:fs/promises'; +import { cp } from 'node:fs/promises'; -const rawTypesDTS = new URL('../typings/rawDataTypes.d.ts', import.meta.url); const rawIndexDTS = new URL('../typings/index.d.ts', import.meta.url); - -const rawTypesMDTS = new URL('../typings/rawDataTypes.d.mts', import.meta.url); const rawIndexMTS = new URL('../typings/index.d.mts', import.meta.url); -const [rawTypesString, rawIndexString] = await Promise.all([ - readFile(rawTypesDTS, 'utf8'), - readFile(rawIndexDTS, 'utf8'), -]); - -/** - * - * @param {string} source - * @param {[from: string, to: string][]} imports - */ -function updateImports(source, imports) { - return imports.reduce((code, [from, to]) => { - return code.replaceAll(from, to); - }, source); -} - -/** @type {[string, string][]} */ -const rawTypesImports = [ - ['./index.js', './index.mjs'], // -]; - -/** @type {[string, string][]} */ -const rawIndexImports = [ - ['./rawDataTypes.js', './rawDataTypes.mjs'], // -]; - -const rawTypesMDTSString = updateImports(rawTypesString, rawTypesImports); -const rawIndexMTSString = updateImports(rawIndexString, rawIndexImports); - -await Promise.all([writeFile(rawTypesMDTS, rawTypesMDTSString), writeFile(rawIndexMTS, rawIndexMTSString)]); +await cp(rawIndexDTS, rawIndexMTS); diff --git a/packages/discord.js/src/index.js b/packages/discord.js/src/index.js index da63703cb..9829b078f 100644 --- a/packages/discord.js/src/index.js +++ b/packages/discord.js/src/index.js @@ -45,7 +45,17 @@ exports.ThreadMemberFlagsBitField = require('./util/ThreadMemberFlagsBitField.js exports.UserFlagsBitField = require('./util/UserFlagsBitField.js').UserFlagsBitField; __exportStar(require('./util/DataResolver.js'), exports); -__exportStar(require('./util/Util.js'), exports); + +exports.cleanCodeBlockContent = require('./util/Util.js').cleanCodeBlockContent; +exports.cleanContent = require('./util/Util.js').cleanContent; +exports.discordSort = require('./util/Util.js').discordSort; +exports.fetchRecommendedShardCount = require('./util/Util.js').fetchRecommendedShardCount; +exports.flatten = require('./util/Util.js').flatten; +exports.parseEmoji = require('./util/Util.js').parseEmoji; +exports.parseWebhookURL = require('./util/Util.js').parseWebhookURL; +exports.resolveColor = require('./util/Util.js').resolveColor; +exports.resolveSKUId = require('./util/Util.js').resolveSKUId; +exports.verifyString = require('./util/Util.js').verifyString; exports.version = require('../package.json').version; diff --git a/packages/discord.js/src/util/Util.js b/packages/discord.js/src/util/Util.js index d51553e8f..29aaac6a5 100644 --- a/packages/discord.js/src/util/Util.js +++ b/packages/discord.js/src/util/Util.js @@ -521,25 +521,28 @@ function resolveSKUId(resolvable) { return null; } -exports.flatten = flatten; +// Public +exports.cleanCodeBlockContent = cleanCodeBlockContent; +exports.cleanContent = cleanContent; +exports.discordSort = discordSort; exports.fetchRecommendedShardCount = fetchRecommendedShardCount; +exports.flatten = flatten; exports.parseEmoji = parseEmoji; +exports.parseWebhookURL = parseWebhookURL; +exports.resolveColor = resolveColor; +exports.resolveSKUId = resolveSKUId; +exports.verifyString = verifyString; + +// Private exports.resolvePartialEmoji = resolvePartialEmoji; exports.resolveGuildEmoji = resolveGuildEmoji; exports.makeError = makeError; exports.makePlainError = makePlainError; exports.getSortableGroupTypes = getSortableGroupTypes; exports.moveElementInArray = moveElementInArray; -exports.verifyString = verifyString; -exports.resolveColor = resolveColor; -exports.discordSort = discordSort; exports.setPosition = setPosition; exports.basename = basename; -exports.cleanContent = cleanContent; -exports.cleanCodeBlockContent = cleanCodeBlockContent; -exports.parseWebhookURL = parseWebhookURL; exports.transformResolved = transformResolved; -exports.resolveSKUId = resolveSKUId; // Fixes Circular const { Attachment } = require('../structures/Attachment.js'); diff --git a/packages/discord.js/tsdoc.json b/packages/discord.js/tsdoc.json new file mode 100644 index 000000000..8680b9142 --- /dev/null +++ b/packages/discord.js/tsdoc.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["@discordjs/api-extractor/extends/tsdoc-base.json"], + "tagDefinitions": [ + { + "tagName": "@unstable", + "syntaxKind": "modifier" + } + ], + "supportForTags": { + "@unstable": true + } +} diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index e95359290..d22d65930 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -1,244 +1,224 @@ -import { Awaitable, JSONEncodable } from '@discordjs/util'; +import { ApplicationCommandOptionAllowedChannelTypes, MessageActionRowComponentBuilder } from '@discordjs/builders'; import { Collection, ReadonlyCollection } from '@discordjs/collection'; import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest'; +import { Awaitable, JSONEncodable } from '@discordjs/util'; import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws'; import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter'; import { + ActivityFlags, + ActivityType, APIActionRowComponent, + APIApplicationCommand, APIApplicationCommandInteractionData, APIApplicationCommandOption, + APIApplicationRoleConnectionMetadata, + APIAttachment, + APIAuditLog, APIAuditLogChange, + APIAuditLogEntry, + APIAuthorizingIntegrationOwnersMap, + APIAutoModerationRule, APIButtonComponent, + APIChannel, + APIChannelSelectComponent, + APIComponentInActionRow, + APIComponentInContainer, + APIComponentInMessageActionRow, + APIComponentInModalActionRow, + APIContainerComponent, APIEmbed, + APIEmbedAuthor, + APIEmbedField, + APIEmbedFooter, + APIEmbedImage, + APIEmbedProvider, APIEmoji, + APIEntitlement, + APIFileComponent, + APIGuild, + APIGuildIntegration, + APIGuildMember, + APIGuildOnboardingPrompt, + APIGuildOnboardingPromptOption, + APIGuildPreview, + APIGuildScheduledEvent, + APIGuildWelcomeScreen, + APIGuildWelcomeScreenChannel, + APIGuildWidget, + APIGuildWidgetMember, APIInteractionDataResolvedChannel, APIInteractionDataResolvedGuildMember, APIInteractionGuildMember, + APIMediaGalleryComponent, + APIMediaGalleryItem, + APIMentionableSelectComponent, APIMessage, + APIMessageButtonInteractionData, + APIMessageChannelSelectInteractionData, APIMessageComponent, + APIMessageComponentEmoji, + APIMessageComponentInteraction, + APIMessageMentionableSelectInteractionData, + APIMessageRoleSelectInteractionData, + APIMessageStringSelectInteractionData, + APIMessageTopLevelComponent, + APIMessageUserSelectInteractionData, + APIModalComponent, + APIModalInteractionResponseCallbackData, + APIModalSubmitInteraction, APIOverwrite, APIPartialChannel, APIPartialEmoji, APIPartialGuild, + APIPoll, + APIPollAnswer, APIRole, + APIRoleSelectComponent, + APISectionComponent, APISelectMenuComponent, + APISelectMenuDefaultValue, + APISelectMenuOption, + APISeparatorComponent, + APISKU, + APISoundboardSound, + APIStickerPack, + APIStringSelectComponent, + APISubscription, + APITeam, + APITeamMember, + APITemplate, APITemplateSerializedSourceGuild, + APITextDisplayComponent, + APITextInputComponent, + APIThreadMember, + APIThumbnailComponent, + APIUnavailableGuild, + APIUnfurledMediaItem, APIUser, + APIUserSelectComponent, + APIVoiceRegion, + ApplicationCommandOptionType, + ApplicationCommandPermissionType, + ApplicationCommandType, + ApplicationFlags, + ApplicationIntegrationType, + ApplicationRoleConnectionMetadataType, + ApplicationWebhookEventStatus, + ApplicationWebhookEventType, + AttachmentFlags, + AuditLogEvent, + AuditLogOptionsType, + AuditLogRuleTriggerType, + AutoModerationActionType, + AutoModerationRuleEventType, + AutoModerationRuleKeywordPresetType, + AutoModerationRuleTriggerType, ButtonStyle, + ChannelFlags, ChannelType, ComponentType, + EmbedType, + EntitlementType, + EntryPointCommandHandlerType, + FormattingPatterns, + ForumLayoutType, + GatewayActivity, + GatewayActivityAssets, + GatewayAutoModerationActionExecutionDispatchData, + GatewayDispatchPayload, + GatewayIntentBits, + GatewayInteractionCreateDispatchData, + GatewayMessageUpdateDispatchData, + GatewayPresenceUpdate, + GatewaySendPayload, + GatewayTypingStartDispatchData, + GatewayVoiceChannelEffectSendDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData, + GuildDefaultMessageNotifications, + GuildExplicitContentFilter, GuildFeature, + GuildMemberFlags, GuildMFALevel, GuildNSFWLevel, + GuildOnboardingMode, + GuildOnboardingPromptType, GuildPremiumTier, + GuildScheduledEventEntityType, + GuildScheduledEventPrivacyLevel, + GuildScheduledEventRecurrenceRuleFrequency, + GuildScheduledEventRecurrenceRuleMonth, + GuildScheduledEventRecurrenceRuleWeekday, + GuildScheduledEventStatus, + GuildSystemChannelFlags, GuildVerificationLevel, - Locale, + GuildWidgetStyle, + ImageFormat, + IntegrationExpireBehavior, + InteractionContextType, + InteractionResponseType, InteractionType, InviteTargetType, + InviteType, + Locale, + LocalizationMap, + MessageActivityType, + MessageFlags, + MessageReferenceType, MessageType, OAuth2Scopes, + OverwriteType, + PermissionFlagsBits, + PollLayoutType, + ReactionType, + RESTAPIInteractionCallbackActivityInstanceResource, + RESTAPIInteractionCallbackObject, + RESTAPIInteractionCallbackResourceObject, + RESTAPIPartialCurrentUserGuild, + RESTAPIPoll, + RESTGetAPIGuildOnboardingResult, + RESTGetAPIGuildThreadsResult, + RESTPatchAPIChannelMessageJSONBody, + RESTPatchAPIInteractionFollowupJSONBody, + RESTPatchAPIInteractionOriginalResponseJSONBody, + RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIApplicationCommandsJSONBody, + RESTPostAPIChannelMessageJSONBody, + RESTPostAPIInteractionCallbackFormDataBody, + RESTPostAPIInteractionCallbackWithResponseResult, + RESTPostAPIInteractionFollowupJSONBody, + RESTPostAPIWebhookWithTokenJSONBody, + RoleFlags, + SelectMenuDefaultValueType, + SeparatorSpacingSize, + SKUFlags, + SKUType, Snowflake, + SortOrderType, StageInstancePrivacyLevel, StickerFormatType, StickerType, + SubscriptionStatus, TeamMemberMembershipState, - WebhookType, - OverwriteType, - GuildExplicitContentFilter, - GuildDefaultMessageNotifications, - ApplicationCommandPermissionType, - ApplicationCommandOptionType, - ApplicationCommandType, - ActivityType, - GuildScheduledEventEntityType, - GuildScheduledEventPrivacyLevel, - GuildScheduledEventStatus, - IntegrationExpireBehavior, - ApplicationFlags, - PermissionFlagsBits, + TeamMemberRole, + TextChannelType, + TextInputStyle, + ThreadAutoArchiveDuration, + ThreadChannelType, ThreadMemberFlags, UserFlags, - MessageFlags, - GuildSystemChannelFlags, - GatewayIntentBits, - ActivityFlags, - AuditLogEvent, - APIMessageComponentEmoji, - EmbedType, - APIComponentInActionRow, - APIModalInteractionResponseCallbackData, - APIModalSubmitInteraction, - APIComponentInMessageActionRow, - TextInputStyle, - APITextInputComponent, - APIComponentInModalActionRow, - APIModalComponent, - APISelectMenuOption, - APIEmbedField, - APIEmbedAuthor, - APIEmbedFooter, - APIEmbedImage, VideoQualityMode, - LocalizationMap, - MessageActivityType, - APIAttachment, - APIChannel, - ThreadAutoArchiveDuration, - FormattingPatterns, - APIEmbedProvider, - AuditLogOptionsType, - TextChannelType, - ChannelFlags, - SortOrderType, - APIMessageStringSelectInteractionData, - APIMessageUserSelectInteractionData, - APIStringSelectComponent, - APIUserSelectComponent, - APIRoleSelectComponent, - APIMentionableSelectComponent, - APIChannelSelectComponent, - APIGuildMember, - APIMessageRoleSelectInteractionData, - APIMessageMentionableSelectInteractionData, - APIMessageChannelSelectInteractionData, - AutoModerationRuleKeywordPresetType, - AutoModerationActionType, - AutoModerationRuleEventType, - AutoModerationRuleTriggerType, - AuditLogRuleTriggerType, - GatewayAutoModerationActionExecutionDispatchData, - APIAutoModerationRule, - ForumLayoutType, - ApplicationRoleConnectionMetadataType, - APIApplicationRoleConnectionMetadata, - ImageFormat, - GuildMemberFlags, - RESTGetAPIGuildThreadsResult, - RESTGetAPIGuildOnboardingResult, - APIGuildOnboardingPrompt, - APIGuildOnboardingPromptOption, - GuildOnboardingPromptType, - AttachmentFlags, - RoleFlags, - TeamMemberRole, - GuildWidgetStyle, - GuildOnboardingMode, - APISKU, - SKUFlags, - SKUType, - APIEntitlement, - EntitlementType, - ApplicationIntegrationType, - InteractionContextType, - APIPoll, - PollLayoutType, - APIPollAnswer, - APISelectMenuDefaultValue, - SelectMenuDefaultValueType, - InviteType, - ReactionType, - APIAuthorizingIntegrationOwnersMap, - MessageReferenceType, - GuildScheduledEventRecurrenceRuleWeekday, - GuildScheduledEventRecurrenceRuleMonth, - GuildScheduledEventRecurrenceRuleFrequency, - APISubscription, - SubscriptionStatus, - GatewaySendPayload, - GatewayDispatchPayload, - ApplicationWebhookEventStatus, - ApplicationWebhookEventType, - RESTPostAPIInteractionCallbackWithResponseResult, - RESTAPIInteractionCallbackObject, - RESTAPIInteractionCallbackResourceObject, - InteractionResponseType, - RESTAPIInteractionCallbackActivityInstanceResource, VoiceChannelEffectSendAnimationType, - GatewayVoiceChannelEffectSendDispatchData, - RESTAPIPoll, - EntryPointCommandHandlerType, - APISoundboardSound, - APIComponentInContainer, - APIContainerComponent, - APIThumbnailComponent, - APISectionComponent, - APITextDisplayComponent, - APIUnfurledMediaItem, - APIMediaGalleryItem, - APIMediaGalleryComponent, - APISeparatorComponent, - SeparatorSpacingSize, - APIFileComponent, - APIMessageTopLevelComponent, + WebhookType, } from 'discord-api-types/v10'; import { ChildProcess } from 'node:child_process'; import { Stream } from 'node:stream'; import { MessagePort, Worker } from 'node:worker_threads'; -import { - RawActivityData, - RawAnonymousGuildData, - RawApplicationCommandData, - RawApplicationData, - RawApplicationEmojiData, - RawBaseGuildData, - RawChannelData, - RawClientApplicationData, - RawDMChannelData, - RawEmojiData, - RawGuildAuditLogData, - RawGuildAuditLogEntryData, - RawGuildBanData, - RawGuildChannelData, - RawGuildData, - RawGuildEmojiData, - RawGuildMemberData, - RawGuildPreviewData, - RawGuildScheduledEventData, - RawGuildTemplateData, - RawIntegrationApplicationData, - RawIntegrationData, - RawInteractionData, - RawInviteData, - RawInviteGuildData, - RawMessageButtonInteractionData, - RawMessageComponentInteractionData, - RawMessageData, - RawMessagePayloadData, - RawMessageReactionData, - RawOAuth2GuildData, - RawPartialGroupDMChannelData, - RawPartialMessageData, - RawPermissionOverwriteData, - RawPresenceData, - RawReactionEmojiData, - RawRichPresenceAssets, - RawRoleData, - RawStageInstanceData, - RawStickerData, - RawStickerPackData, - RawTeamData, - RawTeamMemberData, - RawThreadChannelData, - RawThreadMemberData, - RawTypingData, - RawUserData, - RawVoiceRegionData, - RawVoiceStateData, - RawWebhookData, - RawWelcomeChannelData, - RawWelcomeScreenData, - RawWidgetData, - RawWidgetMemberData, -} from './rawDataTypes.js'; -import { ApplicationCommandOptionAllowedChannelTypes, MessageActionRowComponentBuilder } from '@discordjs/builders'; //#region Classes export class Activity { - private constructor(presence: Presence, data?: RawActivityData); + private constructor(presence: Presence, data?: GatewayActivity); public readonly presence: Presence; public applicationId: Snowflake | null; public assets: RichPresenceAssets | null; @@ -314,7 +294,7 @@ export class ActivityFlagsBitField extends BitField { } export abstract class AnonymousGuild extends BaseGuild { - protected constructor(client: Client, data: RawAnonymousGuildData, immediatePatch?: boolean); + protected constructor(client: Client, data: unknown, immediatePatch?: boolean); public banner: string | null; public description: string | null; public nsfwLevel: GuildNSFWLevel; @@ -387,7 +367,7 @@ export class AutoModerationRule extends Base { } export abstract class Application extends Base { - protected constructor(client: Client, data: RawApplicationData); + protected constructor(client: Client, data: unknown); public get createdAt(): Date; public get createdTimestamp(): number; public description: string | null; @@ -406,7 +386,7 @@ export abstract class Application extends Base { } export class ApplicationCommand extends Base { - private constructor(client: Client, data: RawApplicationCommandData, guild?: Guild, guildId?: Snowflake); + private constructor(client: Client, data: APIApplicationCommand, guild?: Guild, guildId?: Snowflake); public applicationId: Snowflake; public contexts: InteractionContextType[] | null; public get createdAt(): Date; @@ -449,7 +429,7 @@ export class ApplicationCommand extends Base { options: readonly ApplicationCommandOptionData[], ): Promise>; public equals( - command: ApplicationCommand | ApplicationCommandData | RawApplicationCommandData, + command: ApplicationCommand | ApplicationCommandData | APIApplicationCommand, enforceOptionOrder?: boolean, ): boolean; public static optionsEqual( @@ -593,7 +573,7 @@ export abstract class CommandInteraction e } export abstract class BaseGuild extends Base { - protected constructor(client: Client, data: RawBaseGuildData); + protected constructor(client: Client, data: unknown); public get createdAt(): Date; public get createdTimestamp(): number; public features: `${GuildFeature}`[]; @@ -609,7 +589,7 @@ export abstract class BaseGuild extends Base { } export class BaseGuildEmoji extends Emoji { - protected constructor(client: Client, data: RawGuildEmojiData, guild: Guild | GuildPreview); + protected constructor(client: Client, data: APIEmoji, guild: Guild | GuildPreview); public imageURL(options?: ImageURLOptions): string; public get url(): string; public available: boolean | null; @@ -685,7 +665,7 @@ export class BitField extends MessageComponentInteraction { - private constructor(client: Client, data: RawMessageButtonInteractionData); + private constructor(client: Client, data: APIMessageButtonInteractionData); public componentType: ComponentType.Button; public get component(): CacheTypeReducer< Cached, @@ -878,6 +858,17 @@ export abstract class BaseChannel extends Base { public toString(): ChannelMention | UserMention; } +export type RawChannelData = + | RawGuildChannelData + | RawThreadChannelData + | RawDMChannelData + | RawPartialGroupDMChannelData; + +export type RawGuildChannelData = APIChannel | APIInteractionDataResolvedChannel | Required; +export type RawThreadChannelData = APIChannel | APIInteractionDataResolvedChannel; +export type RawDMChannelData = APIChannel | APIInteractionDataResolvedChannel; +export type RawPartialGroupDMChannelData = APIChannel | Required; + export type If = Value extends true ? TrueResult : Value extends false @@ -943,7 +934,7 @@ export interface StickerPackFetchOptions { } export class ClientApplication extends Application { - private constructor(client: Client, data: RawClientApplicationData); + private constructor(client: Client, data: unknown); public botPublic: boolean | null; public botRequireCodeGrant: boolean | null; public bot: User | null; @@ -977,8 +968,8 @@ export class ClientApplication extends Application { } export class ClientPresence extends Presence { - private constructor(client: Client, data: RawPresenceData); - private _parse(data: PresenceData): RawPresenceData; + private constructor(client: Client, data: GatewayPresenceUpdate); + private _parse(data: PresenceData): GatewayPresenceUpdate; public set(presence: PresenceData): ClientPresence; } @@ -1269,7 +1260,7 @@ export class DMChannel extends BaseChannel { } export class Emoji extends Base { - protected constructor(client: Client, emoji: RawEmojiData); + protected constructor(client: Client, emoji: unknown); public animated: boolean | null; public get createdAt(): Date | null; public get createdTimestamp(): number | null; @@ -1292,7 +1283,7 @@ export interface ApplicationEmojiEditOptions { } export class ApplicationEmoji extends Emoji { - private constructor(client: Client, data: RawApplicationEmojiData, application: ClientApplication); + private constructor(client: Client, data: APIEmoji, application: ClientApplication); public application: ClientApplication; public author: User | null; @@ -1307,7 +1298,7 @@ export class ApplicationEmoji extends Emoji { } export class ApplicationEmojiManager extends CachedManager { - private constructor(application: ClientApplication, iterable?: Iterable); + private constructor(application: ClientApplication, iterable?: Iterable); public application: ClientApplication; public create(options: ApplicationEmojiCreateOptions): Promise; public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; @@ -1356,7 +1347,7 @@ export class FileComponent extends Component { } export class Guild extends AnonymousGuild { - private constructor(client: Client, data: RawGuildData); + private constructor(client: Client, data: APIGuild | APIUnavailableGuild); private _sortedRoles(): Collection; private _sortedChannels(channel: NonThreadGuildBasedChannel): Collection; @@ -1477,7 +1468,7 @@ export class Guild extends AnonymousGuild { } export class GuildAuditLogs { - private constructor(guild: Guild, data: RawGuildAuditLogData); + private constructor(guild: Guild, data: APIAuditLog); private applicationCommands: Collection; private webhooks: Collection>; private integrations: Collection; @@ -1496,7 +1487,7 @@ export class GuildAuditLogsEntry< ? GuildAuditLogsTypes[TAction][0] : 'Unknown', > { - private constructor(guild: Guild, data: RawGuildAuditLogEntryData, logs?: GuildAuditLogs); + private constructor(guild: Guild, data: APIAuditLogEntry, logs?: GuildAuditLogs); public static Targets: GuildAuditLogsTargets; public action: TAction; public actionType: TActionType; @@ -1526,7 +1517,7 @@ export class GuildAuditLogsEntry< } export class GuildBan extends Base { - private constructor(client: Client, data: RawGuildBanData, guild: Guild); + private constructor(client: Client, data: unknown, guild: Guild); public guild: Guild; public user: User; public get partial(): boolean; @@ -1573,7 +1564,7 @@ export abstract class GuildChannel extends BaseChannel { } export class GuildEmoji extends BaseGuildEmoji { - private constructor(client: Client, data: RawGuildEmojiData, guild: Guild); + private constructor(client: Client, data: APIEmoji, guild: Guild); private _roles: Snowflake[]; public get deletable(): boolean; @@ -1598,7 +1589,7 @@ export class GuildMemberFlagsBitField extends BitField { export interface GuildMember extends PartialTextBasedChannelFields {} export class GuildMember extends Base { - private constructor(client: Client, data: RawGuildMemberData, guild: Guild); + private constructor(client: Client, data: unknown, guild: Guild); private _roles: Snowflake[]; public avatar: string | null; public banner: string | null; @@ -1689,7 +1680,7 @@ export class GuildOnboardingPromptOption extends Base { } export class GuildPreview extends Base { - private constructor(client: Client, data: RawGuildPreviewData); + private constructor(client: Client, data: APIGuildPreview); public approximateMemberCount: number; public approximatePresenceCount: number; public get createdAt(): Date; @@ -1712,7 +1703,7 @@ export class GuildPreview extends Base { } export class GuildScheduledEvent extends Base { - private constructor(client: Client, data: RawGuildScheduledEventData); + private constructor(client: Client, data: APIGuildScheduledEvent); public id: Snowflake; public guildId: Snowflake; public channelId: Snowflake | null; @@ -1788,7 +1779,7 @@ export interface GuildScheduledEventRecurrenceRuleNWeekday { } export class GuildTemplate extends Base { - private constructor(client: Client, data: RawGuildTemplateData); + private constructor(client: Client, data: APITemplate); public createdTimestamp: number; public updatedTimestamp: number; public get url(): string; @@ -1812,13 +1803,13 @@ export class GuildTemplate extends Base { } export class GuildPreviewEmoji extends BaseGuildEmoji { - private constructor(client: Client, data: RawGuildEmojiData, guild: GuildPreview); + private constructor(client: Client, data: APIEmoji, guild: GuildPreview); public guild: GuildPreview; public roles: Snowflake[]; } export class Integration extends Base { - private constructor(client: Client, data: RawIntegrationData, guild: Guild); + private constructor(client: Client, data: APIGuildIntegration, guild: Guild); public account: IntegrationAccount; public application: IntegrationApplication | null; public enabled: boolean | null; @@ -1842,7 +1833,7 @@ export class Integration extends Base { } export class IntegrationApplication extends Application { - private constructor(client: Client, data: RawIntegrationApplicationData); + private constructor(client: Client, data: unknown); public bot: User | null; public termsOfServiceURL: string | null; public privacyPolicyURL: string | null; @@ -1892,7 +1883,7 @@ export type RepliableInteraction = Exclude export class BaseInteraction extends Base { // This a technique used to brand different cached types. Or else we'll get `never` errors on typeguard checks. private readonly _cacheType: Cached; - protected constructor(client: Client, data: RawInteractionData); + protected constructor(client: Client, data: GatewayInteractionCreateDispatchData); public applicationId: Snowflake; public authorizingIntegrationOwners: APIAuthorizingIntegrationOwnersMap; public get channel(): CacheTypeReducer< @@ -2004,7 +1995,7 @@ export class InteractionWebhook { } export class Invite extends Base { - private constructor(client: Client, data: RawInviteData); + private constructor(client: Client, data: unknown); public channel: NonThreadGuildBasedChannel | PartialGroupDMChannel | null; public channelId: Snowflake | null; public code: string; @@ -2035,7 +2026,7 @@ export class Invite extends Base { } export class InviteGuild extends AnonymousGuild { - private constructor(client: Client, data: RawInviteGuildData); + private constructor(client: Client, data: APIPartialGuild); public welcomeScreen: WelcomeScreen | null; } @@ -2127,8 +2118,8 @@ export interface MappedInteractionTypes { export class Message extends Base { private readonly _cacheType: InGuild; - private constructor(client: Client, data: RawMessageData); - private _patch(data: RawPartialMessageData | RawMessageData): void; + private constructor(client: Client, data: APIMessage); + private _patch(data: GatewayMessageUpdateDispatchData | APIMessage): void; public activity: MessageActivity | null; public applicationId: Snowflake | null; @@ -2267,7 +2258,7 @@ export class MessageCollector extends Collector extends BaseInteraction { - protected constructor(client: Client, data: RawMessageComponentInteractionData); + protected constructor(client: Client, data: APIMessageComponentInteraction); public type: InteractionType.MessageComponent; public get component(): CacheTypeReducer< Cached, @@ -2453,8 +2444,18 @@ export class MessagePayload { public resolveFiles(): Promise; } +export type RawMessagePayloadData = + | RESTPostAPIChannelMessageJSONBody + | RESTPatchAPIChannelMessageJSONBody + | RESTPostAPIWebhookWithTokenJSONBody + | RESTPatchAPIWebhookWithTokenJSONBody + | RESTPostAPIInteractionCallbackFormDataBody + | RESTPatchAPIInteractionOriginalResponseJSONBody + | RESTPostAPIInteractionFollowupJSONBody + | RESTPatchAPIInteractionFollowupJSONBody; + export class MessageReaction { - private constructor(client: Client, data: RawMessageReactionData, message: Message); + private constructor(client: Client, data: unknown, message: Message); private _emoji: GuildEmoji | ReactionEmoji | ApplicationEmoji; public burstColors: string[] | null; @@ -2588,7 +2589,7 @@ export class AnnouncementChannel extends BaseGuildTextChannel { export type AnnouncementChannelResolvable = AnnouncementChannel | Snowflake; export class OAuth2Guild extends BaseGuild { - private constructor(client: Client, data: RawOAuth2GuildData); + private constructor(client: Client, data: RESTAPIPartialCurrentUserGuild); public owner: boolean; public permissions: Readonly; } @@ -2689,7 +2690,7 @@ export class MediaChannel extends ThreadOnlyChannel { } export class PermissionOverwrites extends Base { - private constructor(client: Client, data: RawPermissionOverwriteData, channel: NonThreadGuildBasedChannel); + private constructor(client: Client, data: unknown, channel: NonThreadGuildBasedChannel); public allow: Readonly; public readonly channel: NonThreadGuildBasedChannel; public deny: Readonly; @@ -2722,7 +2723,7 @@ export class PermissionsBitField extends BitField { } export class Presence extends Base { - protected constructor(client: Client, data?: RawPresenceData); + protected constructor(client: Client, data?: GatewayPresenceUpdate); public activities: Activity[]; public clientStatus: ClientPresenceStatusData | null; public guild: Guild | null; @@ -2808,13 +2809,13 @@ export class ReactionCollector extends Collector< } export class ReactionEmoji extends Emoji { - private constructor(reaction: MessageReaction, emoji: RawReactionEmojiData); + private constructor(reaction: MessageReaction, emoji: unknown); public reaction: MessageReaction; public toJSON(): unknown; } export class RichPresenceAssets { - private constructor(activity: Activity, assets: RawRichPresenceAssets); + private constructor(activity: Activity, assets: GatewayActivityAssets); public readonly activity: Activity; public largeImage: Snowflake | null; public largeText: string | null; @@ -2825,7 +2826,7 @@ export class RichPresenceAssets { } export class Role extends Base { - private constructor(client: Client, data: RawRoleData, guild: Guild); + private constructor(client: Client, data: APIRole, guild: Guild); public color: number; public get createdAt(): Date; public get createdTimestamp(): number; @@ -3131,9 +3132,9 @@ export interface FetchRecommendedShardCountOptions { } export { - DiscordSnowflake as SnowflakeUtil, - SnowflakeGenerateOptions, DeconstructedSnowflake, + SnowflakeGenerateOptions, + DiscordSnowflake as SnowflakeUtil, } from '@sapphire/snowflake'; export class SKU extends Base { @@ -3187,7 +3188,7 @@ export class DirectoryChannel extends BaseChannel { } export class StageInstance extends Base { - private constructor(client: Client, data: RawStageInstanceData, channel: StageChannel); + private constructor(client: Client, data: unknown, channel: StageChannel); public id: Snowflake; public guildId: Snowflake; public channelId: Snowflake; @@ -3205,7 +3206,7 @@ export class StageInstance extends Base { } export class Sticker extends Base { - private constructor(client: Client, data: RawStickerData); + private constructor(client: Client, data: unknown); public get createdTimestamp(): number; public get createdAt(): Date; public available: boolean | null; @@ -3231,7 +3232,7 @@ export class Sticker extends Base { } export class StickerPack extends Base { - private constructor(client: Client, data: RawStickerPackData); + private constructor(client: Client, data: APIStickerPack); public get createdTimestamp(): number; public get createdAt(): Date; public bannerId: Snowflake | null; @@ -3326,7 +3327,7 @@ export class SystemChannelFlagsBitField extends BitField, data: RawTeamData); + private constructor(client: Client, data: APITeam); public id: Snowflake; public name: string; public icon: string | null; @@ -3342,7 +3343,7 @@ export class Team extends Base { } export class TeamMember extends Base { - private constructor(team: Team, data: RawTeamMemberData); + private constructor(team: Team, data: APITeamMember); public team: Team; public get id(): Snowflake; public membershipState: TeamMemberMembershipState; @@ -3441,7 +3442,7 @@ export class ThreadChannel extends BaseCha } export class ThreadMember extends Base { - private constructor(thread: ThreadChannel, data: RawThreadMemberData, extra?: unknown); + private constructor(thread: ThreadChannel, data: APIThreadMember, extra?: unknown); public flags: ThreadMemberFlagsBitField; private member: If; public get guildMember(): HasMemberData extends true ? GuildMember : GuildMember | null; @@ -3476,7 +3477,7 @@ export class ThumbnailComponent extends Component { } export class Typing extends Base { - private constructor(channel: TextBasedChannel, user: PartialUser, data?: RawTypingData); + private constructor(channel: TextBasedChannel, user: PartialUser, data?: GatewayTypingStartDispatchData); public channel: TextBasedChannel; public user: User | PartialUser; public startedTimestamp: number; @@ -3507,7 +3508,7 @@ export class UnfurledMediaItem { // tslint:disable-next-line no-empty-interface export interface User extends PartialTextBasedChannelFields {} export class User extends Base { - protected constructor(client: Client, data: RawUserData); + protected constructor(client: Client, data: unknown); private _equals(user: APIUser): boolean; public accentColor: number | null | undefined; @@ -3573,65 +3574,18 @@ export class UserFlagsBitField extends BitField { public static resolve(bit?: BitFieldResolvable): number; } -/** @internal */ -export function basename(path: string, ext?: string): string; +export function cleanCodeBlockContent(text: string): string; export function cleanContent(str: string, channel: TextBasedChannel): string; export function discordSort( collection: ReadonlyCollection, ): Collection; -export function cleanCodeBlockContent(text: string): string; export function fetchRecommendedShardCount(token: string, options?: FetchRecommendedShardCountOptions): Promise; export function flatten(obj: unknown, ...props: Record[]): unknown; - -/** @internal */ -export function makeError(obj: MakeErrorOptions): Error; -/** @internal */ -export function makePlainError(err: Error): MakeErrorOptions; -/** @internal */ -export function moveElementInArray( - // eslint-disable-next-line no-restricted-syntax - array: unknown[], - element: unknown, - newIndex: number, - offset?: boolean, -): number; export function parseEmoji(text: string): PartialEmoji | null; -export function resolveColor(color: ColorResolvable): number; -export function resolvePartialEmoji(emoji: Snowflake): PartialEmojiOnlyId; -export function resolvePartialEmoji(emoji: Emoji | EmojiIdentifierResolvable): PartialEmoji | null; -/** @internal */ -export function resolveGuildEmoji(client: Client, emojiId: Snowflake): GuildEmoji | null; -export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string; -/** @internal */ -export function setPosition( - item: Item, - position: number, - relative: boolean, - sorted: ReadonlyCollection, - client: Client, - route: string, - reason?: string, -): Promise<{ id: Snowflake; position: number }[]>; export function parseWebhookURL(url: string): WebhookClientDataIdWithToken | null; -/** @internal */ -export function transformResolved( - supportingData: SupportingInteractionResolvedData, - data?: Extract['resolved'], -): CommandInteractionResolvedData; +export function resolveColor(color: ColorResolvable): number; export function resolveSKUId(resolvable: SKUResolvable): Snowflake | null; - -/** @internal */ -export interface CreateChannelOptions { - allowFromUnknownGuild?: boolean; -} - -/** @internal */ -export function createChannel( - client: Client, - data: APIChannel, - guild?: Guild, - extras?: CreateChannelOptions, -): Channel; +export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string; export type ComponentData = | MessageActionRowComponentData @@ -3666,7 +3620,7 @@ export class VoiceChannelEffect { } export class VoiceRegion { - private constructor(data: RawVoiceRegionData); + private constructor(data: APIVoiceRegion); public custom: boolean; public deprecated: boolean; public id: string; @@ -3676,7 +3630,7 @@ export class VoiceRegion { } export class VoiceState extends Base { - private constructor(guild: Guild, data: RawVoiceStateData); + private constructor(guild: Guild, data: unknown); public get channel(): VoiceBasedChannel | null; public channelId: Snowflake | null; public get deaf(): boolean | null; @@ -3707,7 +3661,7 @@ export class VoiceState extends Base { // tslint:disable-next-line no-empty-interface export interface Webhook extends WebhookFields {} export class Webhook { - private constructor(client: Client, data?: RawWebhookData); + private constructor(client: Client, data?: unknown); public avatar: string | null; public avatarURL(options?: ImageURLOptions): string | null; public channelId: Snowflake; @@ -3763,8 +3717,8 @@ export class WebhookClient extends BaseClient<{}> { } export class Widget extends Base { - private constructor(client: Client, data: RawWidgetData); - private _patch(data: RawWidgetData): void; + private constructor(client: Client, data: APIGuildWidget); + private _patch(data: APIGuildWidget): void; public fetch(): Promise; public imageURL(style?: GuildWidgetStyle): string; public id: Snowflake; @@ -3776,7 +3730,7 @@ export class Widget extends Base { } export class WidgetMember extends Base { - private constructor(client: Client, data: RawWidgetMemberData); + private constructor(client: Client, data: APIGuildWidgetMember); public id: string; public username: string; public discriminator: string; @@ -3817,7 +3771,7 @@ export type DefaultSoundboardSound = SoundboardSound & { get guild(): null; guil export type GuildSoundboardSound = SoundboardSound & { get guild(): Guild; guildId: Snowflake; soundId: Snowflake }; export class WelcomeChannel extends Base { - private constructor(guild: Guild, data: RawWelcomeChannelData); + private constructor(guild: Guild, data: APIGuildWelcomeScreenChannel); private _emoji: Omit; public channelId: Snowflake; public guild: Guild | InviteGuild; @@ -3827,7 +3781,7 @@ export class WelcomeChannel extends Base { } export class WelcomeScreen extends Base { - private constructor(guild: Guild, data: RawWelcomeScreenData); + private constructor(guild: Guild, data: APIGuildWelcomeScreen); public get enabled(): boolean; public guild: Guild | InviteGuild; public description: string | null; @@ -4240,7 +4194,7 @@ export class SubscriptionManager extends CachedManager {} export class GuildApplicationCommandManager extends ApplicationCommandManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(command: ApplicationCommandDataResolvable): Promise; public delete(command: ApplicationCommandResolvable): Promise; @@ -4304,7 +4258,7 @@ export class GuildChannelManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(options: GuildEmojiCreateOptions): Promise; public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; @@ -4334,7 +4288,7 @@ export interface FetchSoundboardSoundsOptions { } export class GuildManager extends CachedManager { - private constructor(client: Client, iterable?: Iterable); + private constructor(client: Client, iterable?: Iterable); public create(options: GuildCreateOptions): Promise; public fetch(options: Snowflake | FetchGuildOptions): Promise; public fetch(options?: FetchGuildsOptions): Promise>; @@ -4355,7 +4309,7 @@ export interface AddOrRemoveGuildMemberRoleOptions { } export class GuildMemberManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public get me(): GuildMember | null; public add( @@ -4385,7 +4339,7 @@ export class GuildMemberManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(user: UserResolvable, options?: BanOptions): Promise; public fetch(options: UserResolvable | FetchBanOptions): Promise; @@ -4398,7 +4352,7 @@ export class GuildBanManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(channel: GuildInvitableChannelResolvable, options?: InviteCreateOptions): Promise; public fetch(options: InviteResolvable | FetchInviteOptions): Promise; @@ -4411,7 +4365,7 @@ export class GuildScheduledEventManager extends CachedManager< GuildScheduledEvent, GuildScheduledEventResolvable > { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(options: GuildScheduledEventCreateOptions): Promise; public fetch(): Promise>; @@ -4470,7 +4424,7 @@ export class GuildSoundboardSoundManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(options: GuildStickerCreateOptions): Promise; public edit(sticker: StickerResolvable, data?: GuildStickerEditOptions): Promise; @@ -4515,7 +4469,7 @@ export abstract class MessageManager extends Message, MessageResolvable > { - protected constructor(channel: TextBasedChannel, iterable?: Iterable); + protected constructor(channel: TextBasedChannel, iterable?: Iterable); public channel: TextBasedChannel; public delete(message: MessageResolvable): Promise; public edit( @@ -4550,7 +4504,7 @@ export class PermissionOverwriteManager extends CachedManager< PermissionOverwrites, PermissionOverwriteResolvable > { - private constructor(client: Client, iterable?: Iterable); + private constructor(client: Client, iterable?: Iterable); public set( overwrites: readonly OverwriteResolvable[] | ReadonlyCollection, reason?: string, @@ -4575,24 +4529,24 @@ export class PermissionOverwriteManager extends CachedManager< } export class PresenceManager extends CachedManager { - private constructor(client: Client, iterable?: Iterable); + private constructor(client: Client, iterable?: Iterable); } export class ReactionManager extends CachedManager { - private constructor(message: Message, iterable?: Iterable); + private constructor(message: Message, iterable?: Iterable); public message: Message; public removeAll(): Promise; } export class ReactionUserManager extends CachedManager { - private constructor(reaction: MessageReaction, iterable?: Iterable); + private constructor(reaction: MessageReaction, iterable?: Iterable); public reaction: MessageReaction; public fetch(options?: FetchReactionUsersOptions): Promise>; public remove(user?: UserResolvable): Promise; } export class RoleManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public get everyone(): Role; public get highest(): Role; public guild: Guild; @@ -4609,7 +4563,7 @@ export class RoleManager extends CachedManager } export class StageInstanceManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public create(channel: StageChannelResolvable, options: StageInstanceCreateOptions): Promise; public fetch(channel: StageChannelResolvable, options?: BaseFetchOptions): Promise; @@ -4651,7 +4605,7 @@ export class GuildForumThreadManager extends ThreadManager { } export class ThreadMemberManager extends CachedManager { - private constructor(thread: ThreadChannel, iterable?: Iterable); + private constructor(thread: ThreadChannel, iterable?: Iterable); public thread: AnyThreadChannel; public get me(): ThreadMember | null; public add(member: UserResolvable | '@me'): Promise; @@ -4672,7 +4626,7 @@ export class ThreadMemberManager extends CachedManager { - private constructor(client: Client, iterable?: Iterable); + private constructor(client: Client, iterable?: Iterable); private dmChannel(userId: Snowflake): DMChannel | null; public createDM(user: UserResolvable, options?: BaseFetchOptions): Promise; public deleteDM(user: UserResolvable): Promise; @@ -4681,7 +4635,7 @@ export class UserManager extends CachedManager } export class VoiceStateManager extends CachedManager { - private constructor(guild: Guild, iterable?: Iterable); + private constructor(guild: Guild, iterable?: Iterable); public guild: Guild; public fetch(member: UserResolvable | '@me', options?: BaseFetchOptions): Promise; } @@ -4726,7 +4680,6 @@ export interface TextBasedChannelFields; } -/** @internal */ export interface PartialWebhookFields { id: Snowflake; get url(): string; @@ -4741,7 +4694,6 @@ export interface PartialWebhookFields { ): Promise; } -/** @internal */ export interface WebhookFields extends PartialWebhookFields { get createdAt(): Date; get createdTimestamp(): number; @@ -5218,7 +5170,7 @@ export type CacheConstructors = { [Cache in keyof Caches]: Caches[Cache][0] & { name: Cache }; }; -type OverriddenCaches = +export type OverriddenCaches = | 'DMMessageManager' | 'GuildForumThreadManager' | 'GuildMessageManager' @@ -5839,7 +5791,7 @@ export type GlobalSweepFilter = () => | ((value: Value, key: Key, collection: Collection) => boolean) | null; -interface GuildAuditLogsTypes { +export interface GuildAuditLogsTypes { [AuditLogEvent.GuildUpdate]: ['Guild', 'Update']; [AuditLogEvent.ChannelCreate]: ['Channel', 'Create']; [AuditLogEvent.ChannelUpdate]: ['Channel', 'Update']; @@ -6206,7 +6158,7 @@ export type GuildScheduledEventRecurrenceRuleOptions = } >; -type BaseGuildScheduledEventRecurrenceRuleOptions< +export type BaseGuildScheduledEventRecurrenceRuleOptions< Frequency extends GuildScheduledEventRecurrenceRuleFrequency, Extra extends {}, > = { @@ -6406,13 +6358,6 @@ export interface LifetimeFilterOptions { lifetime?: number; } -/** @internal */ -export interface MakeErrorOptions { - name: string; - message: string; - stack: string; -} - export type ActionRowComponentOptions = | ButtonComponentData | StringSelectMenuComponentData @@ -6935,13 +6880,6 @@ export interface StageInstanceEditOptions { privacyLevel?: StageInstancePrivacyLevel; } -/** @internal */ -export interface SupportingInteractionResolvedData { - client: Client; - guild?: Guild; - channel?: GuildTextBasedChannel; -} - export type SweeperKey = keyof SweeperDefinitions; export type CollectionSweepFilter = (value: Value, key: Key, collection: Collection) => boolean; @@ -7029,8 +6967,6 @@ export type TextBasedChannelResolvable = Snowflake | TextBasedChannel; export type ThreadChannelResolvable = Snowflake | ThreadChannel; -export type ThreadChannelType = ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread; - export interface GuildTextThreadCreateOptions extends StartThreadOptions { startMessage?: MessageResolvable; type?: AllowedThreadType; @@ -7182,7 +7118,8 @@ export type Serialized = Value extends symbol | bigint | (() => any) //#region Voice /** - * @internal Use `DiscordGatewayAdapterLibraryMethods` from `@discordjs/voice` instead. + * @remarks + * Use `DiscordGatewayAdapterLibraryMethods` from `@discordjs/voice` instead. */ export interface InternalDiscordGatewayAdapterLibraryMethods { onVoiceServerUpdate(data: GatewayVoiceServerUpdateDispatchData): void; @@ -7191,7 +7128,8 @@ export interface InternalDiscordGatewayAdapterLibraryMethods { } /** - * @internal Use `DiscordGatewayAdapterImplementerMethods` from `@discordjs/voice` instead. + * @remarks + * Use `DiscordGatewayAdapterImplementerMethods` from `@discordjs/voice` instead. */ export interface InternalDiscordGatewayAdapterImplementerMethods { sendPayload(payload: unknown): boolean; @@ -7199,7 +7137,8 @@ export interface InternalDiscordGatewayAdapterImplementerMethods { } /** - * @internal Use `DiscordGatewayAdapterCreator` from `@discordjs/voice` instead. + * @remarks + * Use `DiscordGatewayAdapterCreator` from `@discordjs/voice` instead. */ export type InternalDiscordGatewayAdapterCreator = ( methods: InternalDiscordGatewayAdapterLibraryMethods, @@ -7208,9 +7147,9 @@ export type InternalDiscordGatewayAdapterCreator = ( //#endregion // External -export * from 'discord-api-types/v10'; export * from '@discordjs/builders'; export * from '@discordjs/formatters'; export * from '@discordjs/rest'; export * from '@discordjs/util'; export * from '@discordjs/ws'; +export * from 'discord-api-types/v10'; diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 102732c3d..39e017432 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -1,234 +1,231 @@ -import type { ChildProcess } from 'node:child_process'; -import type { Worker } from 'node:worker_threads'; +import type { ChatInputCommandBuilder, ContextMenuCommandBuilder } from '@discordjs/builders'; +import { ReadonlyCollection } from '@discordjs/collection'; import { + APIButtonComponent, + APIButtonComponentWithCustomId, + APIEmbed, + APIInteractionDataResolvedChannel, + APIInteractionDataResolvedGuildMember, APIInteractionGuildMember, + APIMessage, APIPartialChannel, APIPartialGuild, - APIInteractionDataResolvedGuildMember, - APIInteractionDataResolvedChannel, APIRole, - APIButtonComponent, APISelectMenuComponent, + APIStringSelectComponent, + APITextInputComponent, ApplicationCommandOptionType, - ComponentType, ApplicationCommandPermissionType, - ChannelType, - InteractionType, - GatewayIntentBits, - Locale, - PermissionFlagsBits, + ApplicationCommandType, AuditLogEvent, ButtonStyle, - TextInputStyle, - APIEmbed, - ApplicationCommandType, - APIMessage, - APIStringSelectComponent, - WebhookType, + ChannelType, + ComponentType, + GatewayIntentBits, GuildScheduledEventRecurrenceRuleFrequency, GuildScheduledEventRecurrenceRuleMonth, GuildScheduledEventRecurrenceRuleWeekday, - APIButtonComponentWithCustomId, + InteractionType, + Locale, MessageFlags, - APITextInputComponent, + PermissionFlagsBits, + TextInputStyle, + ThreadChannelType, + WebhookType, } from 'discord-api-types/v10'; +import type { ChildProcess } from 'node:child_process'; +import type { Worker } from 'node:worker_threads'; +import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd'; import { + ActionRow, + ActionRowBuilder, + ActionRowComponent, + ActionRowData, + AnnouncementChannel, + AnyThreadChannel, ApplicationCommand, + ApplicationCommandChannelOption, + ApplicationCommandChannelOptionData, + ApplicationCommandChoicesData, + ApplicationCommandChoicesOption, ApplicationCommandData, ApplicationCommandManager, ApplicationCommandOptionData, + ApplicationCommandPermissionsManager, ApplicationCommandResolvable, + ApplicationCommandSubCommand, ApplicationCommandSubCommandData, + ApplicationCommandSubGroup, ApplicationCommandSubGroupData, - CommandInteraction, - ButtonInteraction, - CacheType, - CategoryChannel, - Client, - ClientApplication, - ClientUser, - Collection, - ChatInputCommandInteraction, - CommandInteractionOption, - CommandInteractionOptionResolver, - CommandOptionNonChoiceResolvableType, - ContextMenuCommandInteraction, - DMChannel, - Guild, - GuildApplicationCommandManager, - GuildChannelManager, - GuildEmoji, - GuildEmojiManager, - GuildMember, - GuildResolvable, - IntentsBitField, - Interaction, - InteractionCollector, - Message, - AttachmentBuilder, - MessageCollector, - MessageComponentInteraction, - MessageReaction, - ModalBuilder, - AnnouncementChannel, - Options, - PartialTextBasedChannelFields, - PartialUser, - PermissionsBitField, - ReactionCollector, - Role, - RoleManager, - Serialized, - ShardClientUtil, - ShardingManager, - Snowflake, - StageChannel, - TextBasedChannelFields, - type TextBasedChannel, - type TextBasedChannelTypes, - type VoiceBasedChannel, - type GuildBasedChannel, - type NonThreadGuildBasedChannel, - type GuildTextBasedChannel, - TextChannel, - ThreadChannel, - ThreadMember, - Typing, - User, - VoiceChannel, - Shard, - Collector, - GuildAuditLogsEntry, - GuildAuditLogs, - type AuditLogChange, - StageInstance, - ActionRowBuilder, - ButtonComponent, - StringSelectMenuComponent, - RepliableInteraction, - ThreadChannelType, - Events, - Status, - CategoryChannelChildManager, - ActionRowData, - MessageActionRowComponentData, - PartialThreadMember, - ThreadMemberFlagsBitField, - ButtonBuilder, - EmbedBuilder, - MessageActionRowComponent, - StringSelectMenuBuilder, - TextInputBuilder, - TextInputComponent, - Embed, - GuildBanManager, - GuildBan, - MessageManager, - ChannelMention, - UserMention, - PartialGroupDMChannel, + ApplicationEmoji, + ApplicationEmojiManager, Attachment, - MessageContextMenuCommandInteraction, - UserContextMenuCommandInteraction, - AnyThreadChannel, - ThreadMemberManager, - CollectedMessageInteraction, - ShardEvents, - Webhook, - WebhookClient, - InteractionWebhook, - ActionRowComponent, - ActionRow, - GuildAuditLogsActionType, - GuildAuditLogsTargetType, - ModalSubmitInteraction, - ForumChannel, - ChannelFlagsBitField, - GuildForumThreadManager, - GuildTextThreadManager, - SelectMenuInteraction, - StringSelectMenuInteraction, - UserSelectMenuInteraction, - RoleSelectMenuInteraction, - ChannelSelectMenuInteraction, - MentionableSelectMenuInteraction, - MessageMentions, + AttachmentBuilder, AutoModerationActionExecution, AutoModerationRule, AutoModerationRuleManager, - PrivateThreadChannel, - PublicThreadChannel, - GuildMemberManager, - GuildMemberFlagsBitField, - ThreadManager, + Awaitable, + ButtonBuilder, + ButtonComponent, + ButtonComponentData, + ButtonInteraction, + CacheType, + CategoryChannel, + CategoryChannelChildManager, + Channel, + ChannelFlagsBitField, + ChannelMention, + ChannelSelectMenuBuilder, + ChannelSelectMenuComponent, + ChannelSelectMenuInteraction, + ChatInputApplicationCommandData, + ChatInputCommandInteraction, + Client, + ClientApplication, + ClientUser, + CollectedMessageInteraction, + Collection, + Collector, + CommandInteraction, + CommandInteractionOption, + CommandInteractionOptionResolver, + CommandOptionNonChoiceResolvableType, + ContainerComponentData, + ContextMenuCommandInteraction, + createComponentBuilder, + DirectoryChannel, + DMChannel, + DMMessageManager, + Embed, + EmbedBuilder, + Emoji, + Entitlement, + Events, FetchedThreads, FetchedThreadsMore, - DMMessageManager, + FileComponentData, + ForumChannel, + Guild, + GuildApplicationCommandManager, + GuildAuditLogs, + GuildAuditLogsActionType, + GuildAuditLogsEntry, + GuildAuditLogsTargetType, + GuildBan, + GuildBanManager, + GuildChannelManager, + GuildEmoji, + GuildEmojiManager, + GuildForumThreadManager, + GuildMember, + GuildMemberFlagsBitField, + GuildMemberManager, GuildMessageManager, - ApplicationCommandChannelOptionData, - ApplicationCommandChannelOption, - ApplicationCommandChoicesOption, - ApplicationCommandChoicesData, - ApplicationCommandSubGroup, - ApplicationCommandSubCommand, - ChatInputApplicationCommandData, - ApplicationCommandPermissionsManager, GuildOnboarding, - StringSelectMenuComponentData, - ButtonComponentData, + GuildResolvable, + GuildScheduledEventManager, + GuildScheduledEventRecurrenceRuleOptions, + GuildTextThreadManager, + IntentsBitField, + Interaction, + InteractionCallbackResponse, + InteractionCollector, + InteractionWebhook, MediaChannel, + MediaGalleryComponentData, + MediaGalleryItemData, + MentionableSelectMenuBuilder, + MentionableSelectMenuComponent, + MentionableSelectMenuInteraction, + Message, + MessageActionRowComponent, + MessageActionRowComponentData, + MessageCollector, + MessageComponentInteraction, + MessageContextMenuCommandInteraction, + MessageManager, + MessageMentions, + MessageReaction, + ModalBuilder, + ModalSubmitInteraction, + Options, PartialDMChannel, + PartialGroupDMChannel, PartialGuildMember, PartialMessage, PartialMessageReaction, - resolvePartialEmoji, - PartialEmojiOnlyId, - Emoji, - PartialEmoji, - Awaitable, - Channel, - DirectoryChannel, - Entitlement, - SKU, - UserSelectMenuBuilder, - RoleSelectMenuBuilder, - ChannelSelectMenuBuilder, - MentionableSelectMenuBuilder, - UserSelectMenuComponent, - RoleSelectMenuComponent, - ChannelSelectMenuComponent, - MentionableSelectMenuComponent, - Poll, - ApplicationEmoji, - ApplicationEmojiManager, - StickerPack, - GuildScheduledEventManager, - SendableChannels, - PollData, - InteractionCallbackResponse, - PrimaryEntryPointCommandInteraction, - GuildScheduledEventRecurrenceRuleOptions, - ThreadOnlyChannel, PartialPoll, PartialPollAnswer, + PartialTextBasedChannelFields, + PartialThreadMember, + PartialUser, + PermissionsBitField, + Poll, PollAnswer, PollAnswerVoterManager, + PollData, PrimaryButtonBuilder, + PrimaryEntryPointCommandInteraction, + PrivateThreadChannel, + PublicThreadChannel, + ReactionCollector, + RepliableInteraction, resolveColor, - createComponentBuilder, + Role, + RoleManager, + RoleSelectMenuBuilder, + RoleSelectMenuComponent, + RoleSelectMenuInteraction, SectionComponentData, - TextDisplayComponentData, - ThumbnailComponentData, - UnfurledMediaItemData, - MediaGalleryComponentData, - MediaGalleryItemData, + SelectMenuInteraction, + SendableChannels, SeparatorComponentData, - FileComponentData, - ContainerComponentData, + Serialized, + Shard, + ShardClientUtil, + ShardEvents, + ShardingManager, + SKU, + Snowflake, + StageChannel, + StageInstance, + Status, + StickerPack, + StringSelectMenuBuilder, + StringSelectMenuComponent, + StringSelectMenuComponentData, + StringSelectMenuInteraction, + TextBasedChannelFields, + TextChannel, + TextDisplayComponentData, + TextInputBuilder, + TextInputComponent, + ThreadChannel, + ThreadManager, + ThreadMember, + ThreadMemberFlagsBitField, + ThreadMemberManager, + ThreadOnlyChannel, + ThumbnailComponentData, + Typing, + UnfurledMediaItemData, + User, + UserContextMenuCommandInteraction, + UserMention, + UserSelectMenuBuilder, + UserSelectMenuComponent, + UserSelectMenuInteraction, + VoiceChannel, + Webhook, + WebhookClient, + type AuditLogChange, + type GuildBasedChannel, + type GuildTextBasedChannel, + type NonThreadGuildBasedChannel, + type TextBasedChannel, + type TextBasedChannelTypes, + type VoiceBasedChannel, } from './index.js'; -import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd'; -import type { ContextMenuCommandBuilder, ChatInputCommandBuilder } from '@discordjs/builders'; -import { ReadonlyCollection } from '@discordjs/collection'; // Test type transformation: declare const serialize: (value: Value) => Serialized; @@ -2756,12 +2753,6 @@ expectType(partialUser.username); expectType(partialUser.tag); expectType(partialUser.discriminator); -declare const emoji: Emoji; -{ - expectType(resolvePartialEmoji('12345678901234567')); - expectType(resolvePartialEmoji(emoji)); -} - declare const application: ClientApplication; declare const entitlement: Entitlement; declare const sku: SKU; diff --git a/packages/discord.js/typings/rawDataTypes.d.ts b/packages/discord.js/typings/rawDataTypes.d.ts deleted file mode 100644 index b6c29feb7..000000000 --- a/packages/discord.js/typings/rawDataTypes.d.ts +++ /dev/null @@ -1,208 +0,0 @@ -// These are aggregate types that are used in the typings file but do not exist as actual exported values. -// To prevent them from showing up in an editor, they are imported from here instead of exporting them there directly. - -import { - APIApplication, - APIApplicationCommand, - APIApplicationCommandInteraction, - APIAttachment, - APIAuditLog, - APIAuditLogEntry, - APIBan, - APIChannel, - APIEmoji, - APIExtendedInvite, - APIGuild, - APIGuildIntegration, - APIGuildIntegrationApplication, - APIGuildMember, - APIGuildPreview, - APIGuildWelcomeScreen, - APIGuildWelcomeScreenChannel, - APIGuildWidget, - APIGuildWidgetMember, - APIInteractionDataResolvedChannel, - APIInteractionDataResolvedGuildMember, - APIInteractionGuildMember, - APIInvite, - APIMessage, - APIMessageButtonInteractionData, - APIMessageComponentInteraction, - APIMessageSelectMenuInteractionData, - APIOverwrite, - APIPartialChannel, - APIPartialEmoji, - APIPartialGuild, - APIReaction, - APIRole, - APIStageInstance, - APISticker, - APIStickerItem, - APIStickerPack, - APITeam, - APITeamMember, - APITemplate, - APIThreadMember, - APIUnavailableGuild, - APIUser, - APIVoiceRegion, - APIVoiceState, - APIWebhook, - GatewayActivity, - GatewayActivityAssets, - GatewayActivityEmoji, - GatewayGuildBanAddDispatchData, - GatewayGuildMemberAddDispatchData, - GatewayGuildMemberUpdateDispatchData, - GatewayInteractionCreateDispatchData, - GatewayInviteCreateDispatchData, - GatewayInviteDeleteDispatchData, - GatewayMessageReactionAddDispatchData, - GatewayMessageUpdateDispatchData, - GatewayPresenceUpdate, - GatewayReadyDispatchData, - GatewayTypingStartDispatchData, - RESTAPIPartialCurrentUserGuild, - RESTGetAPIWebhookWithTokenResult, - RESTPatchAPIChannelMessageJSONBody, - RESTPatchAPICurrentGuildMemberNicknameJSONBody, - RESTPatchAPIInteractionFollowupJSONBody, - RESTPatchAPIInteractionOriginalResponseJSONBody, - RESTPatchAPIWebhookWithTokenJSONBody, - RESTPostAPIChannelMessageJSONBody, - RESTPostAPIInteractionCallbackFormDataBody, - RESTPostAPIInteractionFollowupJSONBody, - RESTPostAPIWebhookWithTokenJSONBody, - Snowflake, - APIGuildScheduledEvent, -} from 'discord-api-types/v10'; -import { GuildChannel, Guild, PermissionOverwrites } from './index.js'; - -export type RawActivityData = GatewayActivity; - -export type RawApplicationData = RawClientApplicationData | RawIntegrationApplicationData; -export type RawClientApplicationData = GatewayReadyDispatchData['application'] | APIMessage['application']; -export type RawIntegrationApplicationData = APIGuildIntegrationApplication | Partial; - -export type RawApplicationCommandData = APIApplicationCommand; - -export type RawChannelData = - | RawGuildChannelData - | RawThreadChannelData - | RawDMChannelData - | RawPartialGroupDMChannelData; -export type RawDMChannelData = APIChannel | APIInteractionDataResolvedChannel; -export type RawGuildChannelData = APIChannel | APIInteractionDataResolvedChannel | Required; -export type RawPartialGroupDMChannelData = APIChannel | Required; -export type RawThreadChannelData = APIChannel | APIInteractionDataResolvedChannel; - -export type RawEmojiData = - | RawGuildEmojiData - | RawReactionEmojiData - | GatewayActivityEmoji - | Omit, 'animated'>; -export type RawApplicationEmojiData = APIEmoji; -export type RawGuildEmojiData = APIEmoji; -export type RawReactionEmojiData = APIEmoji | APIPartialEmoji; - -export type RawGuildAuditLogData = APIAuditLog; - -export type RawGuildAuditLogEntryData = APIAuditLogEntry; - -export type RawGuildBanData = GatewayGuildBanAddDispatchData | APIBan; - -export type RawGuildData = APIGuild | APIUnavailableGuild; -export type RawAnonymousGuildData = RawGuildData | RawInviteGuildData; -export type RawBaseGuildData = RawAnonymousGuildData | RawOAuth2GuildData; -export type RawInviteGuildData = APIPartialGuild; -export type RawOAuth2GuildData = RESTAPIPartialCurrentUserGuild; - -export type RawGuildMemberData = - | APIGuildMember - | APIInteractionGuildMember - | APIInteractionDataResolvedGuildMember - | GatewayGuildMemberAddDispatchData - | GatewayGuildMemberUpdateDispatchData - | Required - | { user: { id: Snowflake } }; -export type RawThreadMemberData = APIThreadMember; - -export type RawGuildPreviewData = APIGuildPreview; - -export type RawGuildScheduledEventData = APIGuildScheduledEvent; - -export type RawGuildTemplateData = APITemplate; - -export type RawIntegrationData = APIGuildIntegration; - -export type RawInteractionData = GatewayInteractionCreateDispatchData; -export type RawCommandInteractionData = APIApplicationCommandInteraction; -export type RawMessageComponentInteractionData = APIMessageComponentInteraction; -export type RawMessageButtonInteractionData = APIMessageButtonInteractionData; -export type RawMessageSelectMenuInteractionData = APIMessageSelectMenuInteractionData; - -export type RawInviteData = - | APIExtendedInvite - | APIInvite - | (GatewayInviteCreateDispatchData & { channel: GuildChannel; guild: Guild }) - | (GatewayInviteDeleteDispatchData & { channel: GuildChannel; guild: Guild }); - -export type RawMessageData = APIMessage; -export type RawPartialMessageData = GatewayMessageUpdateDispatchData; - -export type RawAttachmentData = APIAttachment; - -export type RawMessagePayloadData = - | RESTPostAPIChannelMessageJSONBody - | RESTPatchAPIChannelMessageJSONBody - | RESTPostAPIWebhookWithTokenJSONBody - | RESTPatchAPIWebhookWithTokenJSONBody - | RESTPostAPIInteractionCallbackFormDataBody - | RESTPatchAPIInteractionOriginalResponseJSONBody - | RESTPostAPIInteractionFollowupJSONBody - | RESTPatchAPIInteractionFollowupJSONBody; - -export type RawMessageReactionData = APIReaction | GatewayMessageReactionAddDispatchData; - -export type RawPermissionOverwriteData = APIOverwrite | PermissionOverwrites; - -export type RawPresenceData = GatewayPresenceUpdate; - -export type RawRoleData = APIRole; - -export type RawRichPresenceAssets = GatewayActivityAssets; - -export type RawStageInstanceData = - | APIStageInstance - | (Partial & Pick); - -export type RawStickerData = APISticker | APIStickerItem; - -export type RawStickerPackData = APIStickerPack; - -export type RawTeamData = APITeam; - -export type RawTeamMemberData = APITeamMember; - -export type RawTypingData = GatewayTypingStartDispatchData; - -export type RawUserData = - | (APIUser & { member?: Omit }) - | (GatewayPresenceUpdate['user'] & Pick); - -export type RawVoiceRegionData = APIVoiceRegion; - -export type RawVoiceStateData = APIVoiceState | Omit; - -export type RawWebhookData = - | APIWebhook - | RESTGetAPIWebhookWithTokenResult - | (Partial & Required>); - -export type RawWelcomeChannelData = APIGuildWelcomeScreenChannel; - -export type RawWelcomeScreenData = APIGuildWelcomeScreen; - -export type RawWidgetData = APIGuildWidget; - -export type RawWidgetMemberData = APIGuildWidgetMember; diff --git a/packages/rest/src/lib/errors/DiscordAPIError.ts b/packages/rest/src/lib/errors/DiscordAPIError.ts index a17e20454..e78fee06d 100644 --- a/packages/rest/src/lib/errors/DiscordAPIError.ts +++ b/packages/rest/src/lib/errors/DiscordAPIError.ts @@ -1,15 +1,19 @@ import type { InternalRequest, RawFile } from '../utils/types.js'; -interface DiscordErrorFieldInformation { +export interface DiscordErrorFieldInformation { code: string; message: string; } -interface DiscordErrorGroupWrapper { +export interface DiscordErrorGroupWrapper { _errors: DiscordError[]; } -type DiscordError = DiscordErrorFieldInformation | DiscordErrorGroupWrapper | string | { [k: string]: DiscordError }; +export type DiscordError = + | DiscordErrorFieldInformation + | DiscordErrorGroupWrapper + | string + | { [k: string]: DiscordError }; export interface DiscordErrorData { code: number; diff --git a/packages/rest/src/lib/utils/types.ts b/packages/rest/src/lib/utils/types.ts index 0584c8ecf..4ceba0392 100644 --- a/packages/rest/src/lib/utils/types.ts +++ b/packages/rest/src/lib/utils/types.ts @@ -363,8 +363,6 @@ export type RouteLike = `/${string}`; /** * Internal request options - * - * @internal */ export interface InternalRequest extends RequestData { fullRoute: RouteLike; @@ -377,8 +375,6 @@ export interface HandlerRequestData extends Pick